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
a1f0172b
Commit
a1f0172b
authored
Jan 25, 2022
by
Stanislav Lashmanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve button loading states of MR reviews feature
Closes:
https://gitlab.com/gitlab-org/gitlab/-/issues/333662
parent
d627ce1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
app/assets/javascripts/batch_comments/components/draft_note.vue
...sets/javascripts/batch_comments/components/draft_note.vue
+8
-3
spec/frontend/batch_comments/components/draft_note_spec.js
spec/frontend/batch_comments/components/draft_note_spec.js
+30
-3
No files found.
app/assets/javascripts/batch_comments/components/draft_note.vue
View file @
a1f0172b
...
...
@@ -115,10 +115,15 @@ export default {
></div>
<p
class=
"draft-note-actions d-flex"
>
<publish-button
:show-count=
"true"
:should-publish=
"false"
category=
"secondary"
/>
<publish-button
:show-count=
"true"
:should-publish=
"false"
category=
"secondary"
:disabled=
"isPublishingDraft(draft.id)"
/>
<gl-button
ref=
"publishNowButton
"
:loading=
"isPublishingDraft(draft.id)
|| isPublishing
"
:disabled=
"isPublishing
"
:loading=
"isPublishingDraft(draft.id)"
class=
"gl-ml-3"
@
click=
"publishNow"
>
...
...
spec/frontend/batch_comments/components/draft_note_spec.js
View file @
a1f0172b
import
{
nextTick
}
from
'
vue
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
getByRole
}
from
'
@testing-library/dom
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
DraftNote
from
'
~/batch_comments/components/draft_note.vue
'
;
import
PublishButton
from
'
~/batch_comments/components/publish_button.vue
'
;
import
{
createStore
}
from
'
~/batch_comments/stores
'
;
import
NoteableNote
from
'
~/notes/components/noteable_note.vue
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
...
...
@@ -28,6 +30,8 @@ describe('Batch comments draft note component', () => {
};
const
getList
=
()
=>
getByRole
(
wrapper
.
element
,
'
list
'
);
const
findSubmitReviewButton
=
()
=>
wrapper
.
findComponent
(
PublishButton
);
const
findAddCommentButton
=
()
=>
wrapper
.
findComponent
(
GlButton
);
const
createComponent
=
(
propsData
=
{
draft
})
=>
{
wrapper
=
shallowMount
(
DraftNote
,
{
...
...
@@ -63,7 +67,7 @@ describe('Batch comments draft note component', () => {
describe
(
'
add comment now
'
,
()
=>
{
it
(
'
dispatches publishSingleDraft when clicking
'
,
()
=>
{
createComponent
();
const
publishNowButton
=
wrapper
.
find
({
ref
:
'
publishNowButton
'
}
);
const
publishNowButton
=
findAddCommentButton
(
);
publishNowButton
.
vm
.
$emit
(
'
click
'
);
expect
(
wrapper
.
vm
.
$store
.
dispatch
).
toHaveBeenCalledWith
(
...
...
@@ -77,10 +81,33 @@ describe('Batch comments draft note component', () => {
wrapper
.
vm
.
$store
.
state
.
batchComments
.
currentlyPublishingDrafts
.
push
(
1
);
await
nextTick
();
const
publishNowButton
=
wrapper
.
find
({
ref
:
'
publishNowButton
'
}
);
const
publishNowButton
=
findAddCommentButton
(
);
expect
(
publishNowButton
.
props
().
loading
).
toBe
(
true
);
});
it
(
'
sets as disabled when review is publishing
'
,
async
()
=>
{
createComponent
();
wrapper
.
vm
.
$store
.
state
.
batchComments
.
isPublishing
=
true
;
await
nextTick
();
const
publishNowButton
=
findAddCommentButton
();
expect
(
publishNowButton
.
props
().
disabled
).
toBe
(
true
);
expect
(
publishNowButton
.
props
().
loading
).
toBe
(
false
);
});
});
describe
(
'
submit review
'
,
()
=>
{
it
(
'
sets as disabled when draft is publishing
'
,
async
()
=>
{
createComponent
();
wrapper
.
vm
.
$store
.
state
.
batchComments
.
currentlyPublishingDrafts
.
push
(
1
);
await
nextTick
();
const
publishNowButton
=
findSubmitReviewButton
();
expect
(
publishNowButton
.
attributes
().
disabled
).
toBeTruthy
();
});
});
describe
(
'
update
'
,
()
=>
{
...
...
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