Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e713c68a
Commit
e713c68a
authored
May 16, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable inline submit button when title is blank
[ci skip]
parent
5f2b142b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
app/assets/javascripts/issue_show/components/edit_actions.vue
...assets/javascripts/issue_show/components/edit_actions.vue
+11
-2
app/assets/javascripts/issue_show/components/form.vue
app/assets/javascripts/issue_show/components/form.vue
+1
-0
spec/javascripts/issue_show/components/edit_actions_spec.js
spec/javascripts/issue_show/components/edit_actions_spec.js
+20
-0
No files found.
app/assets/javascripts/issue_show/components/edit_actions.vue
View file @
e713c68a
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
type
:
Boolean
,
type
:
Boolean
,
required
:
true
,
required
:
true
,
},
},
formState
:
{
type
:
Object
,
required
:
true
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -14,6 +18,11 @@
...
@@ -14,6 +18,11 @@
updateLoading
:
false
,
updateLoading
:
false
,
};
};
},
},
computed
:
{
isSubmitEnabled
()
{
return
this
.
formState
.
title
.
trim
()
!==
''
;
},
},
methods
:
{
methods
:
{
updateIssuable
()
{
updateIssuable
()
{
this
.
updateLoading
=
true
;
this
.
updateLoading
=
true
;
...
@@ -38,9 +47,9 @@
...
@@ -38,9 +47,9 @@
<div
class=
"prepend-top-default append-bottom-default clearfix"
>
<div
class=
"prepend-top-default append-bottom-default clearfix"
>
<button
<button
class=
"btn btn-save pull-left"
class=
"btn btn-save pull-left"
:class=
"
{ disabled: updateLoading }"
:class=
"
{ disabled: updateLoading
|| !isSubmitEnabled
}"
type="submit"
type="submit"
:disabled="updateLoading"
:disabled="updateLoading
|| !isSubmitEnabled
"
@click="updateIssuable">
@click="updateIssuable">
Save changes
Save changes
<i
<i
...
...
app/assets/javascripts/issue_show/components/form.vue
View file @
e713c68a
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
<title-field
<title-field
:form-state=
"formState"
/>
:form-state=
"formState"
/>
<edit-actions
<edit-actions
:form-state=
"formState"
:can-destroy=
"canDestroy"
/>
:can-destroy=
"canDestroy"
/>
</form>
</form>
</
template
>
</
template
>
spec/javascripts/issue_show/components/edit_actions_spec.js
View file @
e713c68a
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
editActions
from
'
~/issue_show/components/edit_actions.vue
'
;
import
editActions
from
'
~/issue_show/components/edit_actions.vue
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
eventHub
from
'
~/issue_show/event_hub
'
;
import
Store
from
'
~/issue_show/stores
'
;
describe
(
'
Edit Actions components
'
,
()
=>
{
describe
(
'
Edit Actions components
'
,
()
=>
{
let
vm
;
let
vm
;
beforeEach
((
done
)
=>
{
beforeEach
((
done
)
=>
{
const
Component
=
Vue
.
extend
(
editActions
);
const
Component
=
Vue
.
extend
(
editActions
);
const
store
=
new
Store
({
titleHtml
:
''
,
descriptionHtml
:
''
,
issuableRef
:
''
,
});
store
.
formState
.
title
=
'
test
'
;
spyOn
(
eventHub
,
'
$emit
'
);
spyOn
(
eventHub
,
'
$emit
'
);
vm
=
new
Component
({
vm
=
new
Component
({
propsData
:
{
propsData
:
{
canDestroy
:
true
,
canDestroy
:
true
,
formState
:
store
.
formState
,
},
},
}).
$mount
();
}).
$mount
();
...
@@ -41,6 +49,18 @@ describe('Edit Actions components', () => {
...
@@ -41,6 +49,18 @@ describe('Edit Actions components', () => {
});
});
});
});
it
(
'
disables submit button when title is blank
'
,
(
done
)
=>
{
vm
.
formState
.
title
=
''
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.btn-save
'
).
getAttribute
(
'
disabled
'
),
).
toBe
(
'
disabled
'
);
done
();
});
});
describe
(
'
updateIssuable
'
,
()
=>
{
describe
(
'
updateIssuable
'
,
()
=>
{
it
(
'
sends update.issauble event when clicking save button
'
,
()
=>
{
it
(
'
sends update.issauble event when clicking save button
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.btn-save
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-save
'
).
click
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment