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
3f9c89df
Commit
3f9c89df
authored
Dec 23, 2020
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated `setMethods` method from spec
`@vue/test-utils` 1.x deprecated `setMethods`
parent
4ab9b3ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
ee/spec/frontend/boards/components/sidebar/board_sidebar_epic_select_spec.js
...ards/components/sidebar/board_sidebar_epic_select_spec.js
+19
-9
No files found.
ee/spec/frontend/boards/components/sidebar/board_sidebar_epic_select_spec.js
View file @
3f9c89df
import
{
nextTick
}
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
EpicsSelect
from
'
ee/vue_shared/components/sidebar/epics_select/base.vue
'
;
import
BoardSidebarEpicSelect
from
'
ee/boards/components/sidebar/board_sidebar_epic_select.vue
'
;
import
BoardSidebarEpicSelect
from
'
ee/boards/components/sidebar/board_sidebar_epic_select.vue
'
;
import
{
stubComponent
}
from
'
helpers/stub_component
'
;
import
BoardEditableItem
from
'
~/boards/components/sidebar/board_editable_item.vue
'
;
import
BoardEditableItem
from
'
~/boards/components/sidebar/board_editable_item.vue
'
;
import
{
createStore
}
from
'
~/boards/stores
'
;
import
{
createStore
}
from
'
~/boards/stores
'
;
...
@@ -20,7 +23,10 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
...
@@ -20,7 +23,10 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
wrapper
=
null
;
wrapper
=
null
;
});
});
let
epicsSelectHandleEditClick
;
const
createWrapper
=
()
=>
{
const
createWrapper
=
()
=>
{
epicsSelectHandleEditClick
=
jest
.
fn
();
store
=
createStore
();
store
=
createStore
();
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
(()
=>
{});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
(()
=>
{});
wrapper
=
shallowMount
(
BoardSidebarEpicSelect
,
{
wrapper
=
shallowMount
(
BoardSidebarEpicSelect
,
{
...
@@ -30,7 +36,12 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
...
@@ -30,7 +36,12 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
canUpdate
:
true
,
canUpdate
:
true
,
},
},
stubs
:
{
stubs
:
{
'
board-editable-item
'
:
BoardEditableItem
,
BoardEditableItem
,
EpicsSelect
:
stubComponent
(
EpicsSelect
,
{
methods
:
{
handleEditClick
:
epicsSelectHandleEditClick
,
},
}),
},
},
});
});
...
@@ -50,17 +61,16 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
...
@@ -50,17 +61,16 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
it
(
'
expands the dropdown when editing
'
,
()
=>
{
it
(
'
expands the dropdown when editing
'
,
()
=>
{
createWrapper
();
createWrapper
();
wrapper
.
setMethods
({
openEpicsDropdown
:
jest
.
fn
()
});
findItemWrapper
().
vm
.
$emit
(
'
open
'
);
findItemWrapper
().
vm
.
$emit
(
'
open
'
);
expect
(
wrapper
.
vm
.
openEpicsDropdown
).
toHaveBeenCalled
();
expect
(
epicsSelectHandleEditClick
).
toHaveBeenCalled
();
});
});
describe
(
'
when epic is selected
'
,
()
=>
{
describe
(
'
when epic is selected
'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
();
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
TEST_EPIC
);
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
TEST_EPIC
);
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
{
...
TEST_EPIC
,
id
:
TEST_EPIC_ID
});
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
{
...
TEST_EPIC
,
id
:
TEST_EPIC_ID
});
await
wrapper
.
vm
.
$
nextTick
();
return
nextTick
();
});
});
it
(
'
collapses sidebar and renders epic title
'
,
()
=>
{
it
(
'
collapses sidebar and renders epic title
'
,
()
=>
{
...
@@ -81,11 +91,11 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
...
@@ -81,11 +91,11 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
});
});
describe
(
'
when no epic is selected
'
,
()
=>
{
describe
(
'
when no epic is selected
'
,
()
=>
{
beforeEach
(
async
()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
();
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
null
);
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
null
);
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
null
);
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
null
);
await
wrapper
.
vm
.
$
nextTick
();
return
nextTick
();
});
});
it
(
'
collapses sidebar and renders "None"
'
,
()
=>
{
it
(
'
collapses sidebar and renders "None"
'
,
()
=>
{
...
@@ -101,14 +111,14 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
...
@@ -101,14 +111,14 @@ describe('ee/boards/components/sidebar/board_sidebar_epic_select.vue', () => {
describe
(
'
when the mutation fails
'
,
()
=>
{
describe
(
'
when the mutation fails
'
,
()
=>
{
const
issueWithEpic
=
{
...
TEST_ISSUE
,
epic
:
TEST_EPIC
};
const
issueWithEpic
=
{
...
TEST_ISSUE
,
epic
:
TEST_EPIC
};
beforeEach
(
async
()
=>
{
beforeEach
(()
=>
{
createWrapper
();
createWrapper
();
store
.
state
.
issues
=
{
[
TEST_ISSUE
.
id
]:
{
...
issueWithEpic
}
};
store
.
state
.
issues
=
{
[
TEST_ISSUE
.
id
]:
{
...
issueWithEpic
}
};
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
{
jest
.
spyOn
(
wrapper
.
vm
,
'
setActiveIssueEpic
'
).
mockImplementation
(()
=>
{
throw
new
Error
([
'
failed mutation
'
]);
throw
new
Error
([
'
failed mutation
'
]);
});
});
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
{});
findEpicSelect
().
vm
.
$emit
(
'
onEpicSelect
'
,
{});
await
wrapper
.
vm
.
$
nextTick
();
return
nextTick
();
});
});
it
(
'
collapses sidebar and renders former issue epic
'
,
()
=>
{
it
(
'
collapses sidebar and renders former issue epic
'
,
()
=>
{
...
...
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