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
6c6023ea
Commit
6c6023ea
authored
Dec 23, 2020
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix requirement_form_spec with latest `@vue/test-utils`
- update nextTick usages - force valid state in test
parent
4ab9b3ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
ee/spec/frontend/requirements/components/requirement_form_spec.js
...frontend/requirements/components/requirement_form_spec.js
+15
-7
No files found.
ee/spec/frontend/requirements/components/requirement_form_spec.js
View file @
6c6023ea
import
{
nextTick
}
from
'
vue
'
;
import
{
GlDrawer
,
GlFormCheckbox
}
from
'
@gitlab/ui
'
;
import
{
getByText
}
from
'
@testing-library/dom
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
...
...
@@ -95,7 +96,7 @@ describe('RequirementForm', () => {
requirement
:
mockRequirementsOpen
[
0
],
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
wrapper
.
vm
.
requirementObject
).
toBe
(
mockRequirementsOpen
[
0
]);
});
...
...
@@ -105,7 +106,7 @@ describe('RequirementForm', () => {
requirement
:
null
,
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
wrapper
.
vm
.
requirementObject
).
toMatchObject
({
iid
:
''
,
...
...
@@ -131,7 +132,7 @@ describe('RequirementForm', () => {
wrapper
=
createComponent
();
wrapper
.
setProps
({
requirement
,
enableRequirementEdit
:
true
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
wrapper
.
find
(
GlFormCheckbox
).
vm
.
$attrs
.
checked
).
toBe
(
satisfied
);
},
...
...
@@ -147,7 +148,7 @@ describe('RequirementForm', () => {
});
it
(
'
does not render the satisfied checkbox
'
,
async
()
=>
{
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
wrapper
.
find
(
GlFormCheckbox
).
exists
()).
toBe
(
false
);
});
});
...
...
@@ -159,7 +160,7 @@ describe('RequirementForm', () => {
drawerOpen
:
false
,
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
wrapper
.
vm
.
satisfied
).
toBe
(
false
);
});
...
...
@@ -167,11 +168,18 @@ describe('RequirementForm', () => {
it
(
'
binds `keydown` event listener on document when `drawerOpen` prop is changed to true
'
,
async
()
=>
{
jest
.
spyOn
(
document
,
'
addEventListener
'
);
wrapper
.
setProps
({
drawerOpen
:
false
,
});
await
nextTick
();
expect
(
document
.
addEventListener
).
not
.
toHaveBeenCalled
();
wrapper
.
setProps
({
drawerOpen
:
true
,
});
await
wrapper
.
vm
.
$
nextTick
();
await
nextTick
();
expect
(
document
.
addEventListener
).
toHaveBeenCalledWith
(
'
keydown
'
,
expect
.
any
(
Function
));
});
...
...
@@ -323,7 +331,7 @@ describe('RequirementForm', () => {
enableRequirementEdit
:
true
,
});
await
wrapperWithRequirement
.
vm
.
$
nextTick
();
await
nextTick
();
const
issuableBody
=
wrapperWithRequirement
.
find
(
IssuableBody
);
...
...
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