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
f2a3c80d
Commit
f2a3c80d
authored
Dec 23, 2019
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nextTick to setMethods calls in Jest
This commit makes all setMethods calls async
parent
97f28e0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
spec/frontend/registry/list/components/collapsible_container_spec.js
...nd/registry/list/components/collapsible_container_spec.js
+1
-0
spec/frontend/registry/list/components/table_registry_spec.js
.../frontend/registry/list/components/table_registry_spec.js
+13
-11
No files found.
spec/frontend/registry/list/components/collapsible_container_spec.js
View file @
f2a3c80d
...
...
@@ -59,6 +59,7 @@ describe('collapsible registry container', () => {
beforeEach
(()
=>
{
const
fetchList
=
jest
.
fn
();
wrapper
.
setMethods
({
fetchList
});
return
wrapper
.
vm
.
$nextTick
();
});
const
expectIsClosed
=
()
=>
{
...
...
spec/frontend/registry/list/components/table_registry_spec.js
View file @
f2a3c80d
...
...
@@ -123,17 +123,17 @@ describe('table registry', () => {
it
(
'
should delete multiple items when multiple items are selected
'
,
done
=>
{
const
multiDeleteItems
=
jest
.
fn
().
mockResolvedValue
();
wrapper
.
setMethods
({
multiDeleteItems
});
const
selectAll
=
findSelectAllCheckbox
();
selectAll
.
trigger
(
'
click
'
);
Vue
.
nextTick
(()
=>
{
const
deleteBtn
=
findDeleteButton
();
expect
(
wrapper
.
vm
.
selectedItems
).
toEqual
([
0
,
1
]);
expect
(
deleteBtn
.
attributes
(
'
disabled
'
)).
toEqual
(
undefined
);
wrapper
.
setData
({
itemsToBeDeleted
:
[...
wrapper
.
vm
.
selectedItems
]
});
wrapper
.
vm
.
handleMultipleDelete
();
const
selectAll
=
findSelectAllCheckbox
();
selectAll
.
trigger
(
'
click
'
);
Vue
.
nextTick
(()
=>
{
const
deleteBtn
=
findDeleteButton
();
expect
(
wrapper
.
vm
.
selectedItems
).
toEqual
([
0
,
1
]);
expect
(
deleteBtn
.
attributes
(
'
disabled
'
)).
toEqual
(
undefined
);
wrapper
.
setData
({
itemsToBeDeleted
:
[...
wrapper
.
vm
.
selectedItems
]
});
wrapper
.
vm
.
handleMultipleDelete
();
expect
(
wrapper
.
vm
.
selectedItems
).
toEqual
([]);
expect
(
wrapper
.
vm
.
itemsToBeDeleted
).
toEqual
([]);
expect
(
wrapper
.
vm
.
multiDeleteItems
).
toHaveBeenCalledWith
({
...
...
@@ -179,10 +179,12 @@ describe('table registry', () => {
const
deleteSingleItem
=
jest
.
fn
();
const
deleteItem
=
jest
.
fn
().
mockResolvedValue
();
wrapper
.
setMethods
({
deleteSingleItem
,
deleteItem
});
deleteBtns
.
at
(
0
).
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
deleteSingleItem
).
toHaveBeenCalledWith
(
0
);
wrapper
.
vm
.
handleSingleDelete
(
1
);
expect
(
wrapper
.
vm
.
deleteItem
).
toHaveBeenCalledWith
(
1
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
deleteBtns
.
at
(
0
).
trigger
(
'
click
'
);
expect
(
wrapper
.
vm
.
deleteSingleItem
).
toHaveBeenCalledWith
(
0
);
wrapper
.
vm
.
handleSingleDelete
(
1
);
expect
(
wrapper
.
vm
.
deleteItem
).
toHaveBeenCalledWith
(
1
);
});
});
});
...
...
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