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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
a783158b
Commit
a783158b
authored
Jan 10, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update tests for modal changes
parent
5082b8d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
33 deletions
+7
-33
spec/javascripts/groups/components/item_actions_spec.js
spec/javascripts/groups/components/item_actions_spec.js
+7
-33
No files found.
spec/javascripts/groups/components/item_actions_spec.js
View file @
a783158b
...
...
@@ -26,32 +26,12 @@ describe('ItemActionsComponent', () => {
vm
.
$destroy
();
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
leaveConfirmationMessage
'
,
()
=>
{
it
(
'
should return appropriate string for leave group confirmation
'
,
()
=>
{
expect
(
vm
.
leaveConfirmationMessage
).
toBe
(
'
Are you sure you want to leave the "platform / hardware" group?
'
);
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
onLeaveGroup
'
,
()
=>
{
it
(
'
should change `modalStatus` prop to `true` which shows confirmation dialog
'
,
()
=>
{
expect
(
vm
.
modalStatus
).
toBeFalsy
();
vm
.
onLeaveGroup
();
expect
(
vm
.
modalStatus
).
toBeTruthy
();
});
});
describe
(
'
leaveGroup
'
,
()
=>
{
it
(
'
should change `modalStatus` prop to `false` and emit `leaveGroup` event with required params when called with `leaveConfirmed` as `true`
'
,
()
=>
{
it
(
'
emits `showLeaveGroupModal` event with `group` and `parentGroup` props
'
,
()
=>
{
spyOn
(
eventHub
,
'
$emit
'
);
vm
.
modalStatus
=
true
;
vm
.
leaveGroup
();
expect
(
vm
.
modalStatus
).
toBeFalsy
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
leaveGroup
'
,
vm
.
group
,
vm
.
parentGroup
);
vm
.
onLeaveGroup
();
expect
(
eventHub
.
$emit
).
toHaveBeenCalledWith
(
'
showLeaveGroupModal
'
,
vm
.
group
,
vm
.
parentGroup
);
});
});
});
...
...
@@ -72,7 +52,8 @@ describe('ItemActionsComponent', () => {
expect
(
editBtn
.
getAttribute
(
'
href
'
)).
toBe
(
group
.
editPath
);
expect
(
editBtn
.
getAttribute
(
'
aria-label
'
)).
toBe
(
'
Edit group
'
);
expect
(
editBtn
.
dataset
.
originalTitle
).
toBe
(
'
Edit group
'
);
expect
(
editBtn
.
querySelector
(
'
i.fa.fa-cogs
'
)).
toBeDefined
();
expect
(
editBtn
.
querySelectorAll
(
'
svg use
'
).
length
).
not
.
toBe
(
0
);
expect
(
editBtn
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
#settings
'
);
newVm
.
$destroy
();
});
...
...
@@ -88,17 +69,10 @@ describe('ItemActionsComponent', () => {
expect
(
leaveBtn
.
getAttribute
(
'
href
'
)).
toBe
(
group
.
leavePath
);
expect
(
leaveBtn
.
getAttribute
(
'
aria-label
'
)).
toBe
(
'
Leave this group
'
);
expect
(
leaveBtn
.
dataset
.
originalTitle
).
toBe
(
'
Leave this group
'
);
expect
(
leaveBtn
.
querySelector
(
'
i.fa.fa-sign-out
'
)).
toBeDefined
();
expect
(
leaveBtn
.
querySelectorAll
(
'
svg use
'
).
length
).
not
.
toBe
(
0
);
expect
(
leaveBtn
.
querySelector
(
'
svg use
'
).
getAttribute
(
'
xlink:href
'
)).
toContain
(
'
#leave
'
);
newVm
.
$destroy
();
});
it
(
'
should show modal dialog when `modalStatus` is set to `true`
'
,
()
=>
{
vm
.
modalStatus
=
true
;
const
modalDialogEl
=
vm
.
$el
.
querySelector
(
'
.modal
'
);
expect
(
modalDialogEl
).
toBeDefined
();
expect
(
modalDialogEl
.
querySelector
(
'
.modal-title
'
).
innerText
.
trim
()).
toBe
(
'
Are you sure?
'
);
expect
(
modalDialogEl
.
querySelector
(
'
.btn.btn-warning
'
).
innerText
.
trim
()).
toBe
(
'
Leave
'
);
});
});
});
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