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
f549e5a6
Commit
f549e5a6
authored
Aug 21, 2020
by
Christie Lenneville
Committed by
Enrique Alcántara
Aug 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate comment and close to gl button
parent
d91c949f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
13 deletions
+45
-13
app/assets/javascripts/notes/components/comment_form.vue
app/assets/javascripts/notes/components/comment_form.vue
+12
-8
spec/frontend/notes/components/comment_form_spec.js
spec/frontend/notes/components/comment_form_spec.js
+33
-5
No files found.
app/assets/javascripts/notes/components/comment_form.vue
View file @
f549e5a6
...
...
@@ -3,7 +3,7 @@ import $ from 'jquery';
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
{
isEmpty
}
from
'
lodash
'
;
import
Autosize
from
'
autosize
'
;
import
{
GlAlert
,
GlIntersperse
,
GlLink
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
GlAlert
,
GlIntersperse
,
GlLink
,
GlSprintf
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
TimelineEntryItem
from
'
~/vue_shared/components/notes/timeline_entry_item.vue
'
;
import
{
deprecatedCreateFlash
as
Flash
}
from
'
../../flash
'
;
...
...
@@ -20,7 +20,6 @@ import eventHub from '../event_hub';
import
NoteableWarning
from
'
../../vue_shared/components/notes/noteable_warning.vue
'
;
import
markdownField
from
'
../../vue_shared/components/markdown/field.vue
'
;
import
userAvatarLink
from
'
../../vue_shared/components/user_avatar/user_avatar_link.vue
'
;
import
loadingButton
from
'
../../vue_shared/components/loading_button.vue
'
;
import
noteSignedOutWidget
from
'
./note_signed_out_widget.vue
'
;
import
discussionLockedWidget
from
'
./discussion_locked_widget.vue
'
;
import
issuableStateMixin
from
'
../mixins/issuable_state
'
;
...
...
@@ -33,7 +32,7 @@ export default {
discussionLockedWidget
,
markdownField
,
userAvatarLink
,
loading
Button
,
Gl
Button
,
TimelineEntryItem
,
GlAlert
,
GlIntersperse
,
...
...
@@ -102,6 +101,9 @@ export default {
noteable
:
this
.
noteableDisplayName
,
});
},
buttonVariant
()
{
return
this
.
isOpen
?
'
warning
'
:
'
default
'
;
},
actionButtonClassNames
()
{
return
{
'
btn-reopen
'
:
!
this
.
isOpen
,
...
...
@@ -480,17 +482,19 @@ export default {
</ul>
</div>
<
loading
-button
<
gl
-button
v-if=
"canToggleIssueState && !isToggleBlockedIssueWarning"
:loading=
"isToggleStateButtonLoading"
:container-class=
"[
category=
"secondary"
:variant=
"buttonVariant"
:class=
"[
actionButtonClassNames,
'btn
btn
-comment btn-comment-and-close js-action-button',
'btn-comment btn-comment-and-close js-action-button',
]"
:disabled=
"isToggleStateButtonLoading || isSubmitting"
:label=
"issueActionButtonTitle"
@
click=
"handleSave(true)"
/>
>
{{ issueActionButtonTitle }}
</gl-button
>
</div>
</form>
</div>
...
...
spec/frontend/notes/components/comment_form_spec.js
View file @
f549e5a6
...
...
@@ -267,15 +267,14 @@ describe('issue_comment_form component', () => {
});
describe
(
'
when clicking close/reopen button
'
,
()
=>
{
it
(
'
should disable button and show a loading spinner
'
,
done
=>
{
it
(
'
should disable button and show a loading spinner
'
,
()
=>
{
const
toggleStateButton
=
wrapper
.
find
(
'
.js-action-button
'
);
toggleStateButton
.
trigger
(
'
click
'
);
wrapper
.
vm
.
$nextTick
(()
=>
{
expect
(
toggleStateButton
.
element
.
disabled
).
toEqual
(
true
);
expect
(
toggleStateButton
.
find
(
'
.js-loading-button-icon
'
).
exists
()).
toBe
(
true
);
done
();
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
toggleStateButton
.
element
.
disabled
).
toEqual
(
true
);
expect
(
toggleStateButton
.
props
(
'
loading
'
)).
toBe
(
true
);
});
});
});
...
...
@@ -321,4 +320,33 @@ describe('issue_comment_form component', () => {
expect
(
wrapper
.
find
(
'
textarea
'
).
exists
()).
toBe
(
false
);
});
});
describe
(
'
when issuable is open
'
,
()
=>
{
beforeEach
(()
=>
{
setupStore
(
userDataMock
,
noteableDataMock
);
});
it
.
each
([[
'
opened
'
,
'
warning
'
],
[
'
reopened
'
,
'
warning
'
]])(
'
when %i, it changes the variant of the btn to %i
'
,
(
a
,
expected
)
=>
{
store
.
state
.
noteableData
.
state
=
a
;
mountComponent
();
expect
(
wrapper
.
find
(
'
.js-action-button
'
).
props
(
'
variant
'
)).
toBe
(
expected
);
},
);
});
describe
(
'
when issuable is not open
'
,
()
=>
{
beforeEach
(()
=>
{
setupStore
(
userDataMock
,
noteableDataMock
);
mountComponent
();
});
it
(
'
should render the "default" variant of the button
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-action-button
'
).
props
(
'
variant
'
)).
toBe
(
'
warning
'
);
});
});
});
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