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
e40e2d04
Commit
e40e2d04
authored
Jun 29, 2020
by
jakeburden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update assign/unassign test formatting
parent
466943e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
22 deletions
+55
-22
spec/frontend/notes/components/note_actions_spec.js
spec/frontend/notes/components/note_actions_spec.js
+55
-22
No files found.
spec/frontend/notes/components/note_actions_spec.js
View file @
e40e2d04
...
...
@@ -127,36 +127,69 @@ describe('noteActions', () => {
.
catch
(
done
.
fail
);
});
it
(
'
should be possible to assign or unassign the comment author if the user has access to edit an issue
'
,
()
=>
{
store
.
dispatch
(
'
setNoteableData
'
,
{
current_user
:
{
can_update
:
true
,
},
});
wrapper
=
shallowMountNoteActions
(
props
,
{
targetType
:
()
=>
'
issue
'
,
});
it
(
'
should not be possible to assign or unassign the comment author in a merge request
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
});
});
});
assignUserButton
.
trigger
(
'
click
'
);
axiosMock
.
onPut
(
`
${
TEST_HOST
}
/api/v4/projects/group/project/issues/1`
).
reply
(()
=>
{
expect
(
actions
.
updateAssignees
).
toHaveBeenCalled
();
}
);
describe
(
'
when a user has access to edit an issue
'
,
()
=>
{
beforeEach
(()
=>
{
axiosMock
.
onPut
(
`
${
TEST_HOST
}
/api/v4/projects/group/project/issues/1`
).
reply
(()
=>
{
expect
(
actions
.
updateAssignees
).
toHaveBeenCalled
(
);
});
it
(
'
should not be possible to assign or unassign the comment author if the user does not have access to edit an issue
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
store
.
dispatch
(
'
setNoteableData
'
,
{
current_user
:
{
can_update
:
true
,
},
});
it
(
'
should not be possible to assign or unassign the comment author in a merge request
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
wrapper
=
shallowMountNoteActions
(
props
,
{
targetType
:
()
=>
'
issue
'
,
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
axiosMock
.
restore
();
});
it
(
'
should be possible to assign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
assignUserButton
.
trigger
(
'
click
'
);
});
it
(
'
should be possible to unassign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
true
);
assignUserButton
.
trigger
(
'
click
'
);
});
});
describe
(
'
when a user does not have access to edit an issue
'
,
()
=>
{
beforeEach
(()
=>
{
wrapper
=
shallowMountNoteActions
(
props
,
{
targetType
:
()
=>
'
issue
'
,
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
should not be possible to assign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
});
it
(
'
should not be possible to unassign the comment author
'
,
()
=>
{
const
assignUserButton
=
wrapper
.
find
(
'
[data-testid="assign-user"]
'
);
expect
(
assignUserButton
.
exists
()).
toBe
(
false
);
});
});
describe
(
'
user is not logged in
'
,
()
=>
{
...
...
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