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
23e014a9
Commit
23e014a9
authored
May 19, 2020
by
Himanshu Kapoor
Committed by
Enrique Alcántara
May 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate javascripts/sidebar specs to Jest
Migrate specs in spec/javascripts/sidebar from Karma to Jest.
parent
454c8f25
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
193 additions
and
32 deletions
+193
-32
spec/frontend/sidebar/components/time_tracking/time_tracker_spec.js
...end/sidebar/components/time_tracking/time_tracker_spec.js
+23
-22
spec/frontend/sidebar/lock/lock_issue_sidebar_spec.js
spec/frontend/sidebar/lock/lock_issue_sidebar_spec.js
+3
-3
spec/frontend/sidebar/sidebar_move_issue_spec.js
spec/frontend/sidebar/sidebar_move_issue_spec.js
+167
-0
spec/javascripts/sidebar/mock_data.js
spec/javascripts/sidebar/mock_data.js
+0
-7
No files found.
spec/
javascripts
/sidebar/components/time_tracking/time_tracker_spec.js
→
spec/
frontend
/sidebar/components/time_tracking/time_tracker_spec.js
View file @
23e014a9
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
mountComponent
from
'
spec/
helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
TimeTracker
from
'
~/sidebar/components/time_tracking/time_tracker.vue
'
;
import
TimeTracker
from
'
~/sidebar/components/time_tracking/time_tracker.vue
'
;
describe
(
'
Issuable Time Tracker
'
,
()
=>
{
describe
(
'
Issuable Time Tracker
'
,
()
=>
{
...
@@ -35,7 +35,9 @@ describe('Issuable Time Tracker', () => {
...
@@ -35,7 +35,9 @@ describe('Issuable Time Tracker', () => {
...
TimeTracker
.
components
,
...
TimeTracker
.
components
,
transition
:
{
transition
:
{
// disable animations
// disable animations
template
:
'
<div><slot></slot></div>
'
,
render
(
h
)
{
return
h
(
'
div
'
,
this
.
$slots
.
default
);
},
},
},
},
},
});
});
...
@@ -100,9 +102,9 @@ describe('Issuable Time Tracker', () => {
...
@@ -100,9 +102,9 @@ describe('Issuable Time Tracker', () => {
it
(
'
should show full times when the sidebar is collapsed
'
,
done
=>
{
it
(
'
should show full times when the sidebar is collapsed
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
const
timeTrackingText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-collapsed-summary span
'
)
const
timeTrackingText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-collapsed-summary span
'
)
.
innerTex
t
;
.
textConten
t
;
expect
(
timeTrackingText
).
toBe
(
'
1h 23m / 1d 3h
'
);
expect
(
timeTrackingText
.
trim
()
).
toBe
(
'
1h 23m / 1d 3h
'
);
done
();
done
();
});
});
});
});
...
@@ -175,10 +177,10 @@ describe('Issuable Time Tracker', () => {
...
@@ -175,10 +177,10 @@ describe('Issuable Time Tracker', () => {
it
(
'
should display the human readable version of time estimated
'
,
done
=>
{
it
(
'
should display the human readable version of time estimated
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
const
estimateText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-estimate-only-pane
'
)
const
estimateText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-estimate-only-pane
'
)
.
innerTex
t
;
.
textConten
t
;
const
correctText
=
'
Estimated: 2h 46m
'
;
const
correctText
=
'
Estimated:
2h 46m
'
;
expect
(
estimateText
).
toBe
(
correctText
);
expect
(
estimateText
.
trim
()
).
toBe
(
correctText
);
done
();
done
();
});
});
});
});
...
@@ -196,7 +198,7 @@ describe('Issuable Time Tracker', () => {
...
@@ -196,7 +198,7 @@ describe('Issuable Time Tracker', () => {
it
(
'
should display the human readable version of time spent
'
,
done
=>
{
it
(
'
should display the human readable version of time spent
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
const
spentText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-spend-only-pane
'
).
innerTex
t
;
const
spentText
=
vm
.
$el
.
querySelector
(
'
.time-tracking-spend-only-pane
'
).
textConten
t
;
const
correctText
=
'
Spent: 1h 23m
'
;
const
correctText
=
'
Spent: 1h 23m
'
;
expect
(
spentText
).
toBe
(
correctText
);
expect
(
spentText
).
toBe
(
correctText
);
...
@@ -218,12 +220,12 @@ describe('Issuable Time Tracker', () => {
...
@@ -218,12 +220,12 @@ describe('Issuable Time Tracker', () => {
it
(
'
should only show the "No time tracking" pane when both timeEstimate and time_spent are falsey
'
,
done
=>
{
it
(
'
should only show the "No time tracking" pane when both timeEstimate and time_spent are falsey
'
,
done
=>
{
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
const
$noTrackingPane
=
vm
.
$el
.
querySelector
(
'
.time-tracking-no-tracking-pane
'
);
const
$noTrackingPane
=
vm
.
$el
.
querySelector
(
'
.time-tracking-no-tracking-pane
'
);
const
noTrackingText
=
$noTrackingPane
.
innerTex
t
;
const
noTrackingText
=
$noTrackingPane
.
textConten
t
;
const
correctText
=
'
No estimate or time spent
'
;
const
correctText
=
'
No estimate or time spent
'
;
expect
(
vm
.
showNoTimeTrackingState
).
toBe
(
true
);
expect
(
vm
.
showNoTimeTrackingState
).
toBe
(
true
);
expect
(
$noTrackingPane
).
toBeVisible
();
expect
(
$noTrackingPane
).
toBeVisible
();
expect
(
noTrackingText
).
toBe
(
correctText
);
expect
(
noTrackingText
.
trim
()
).
toBe
(
correctText
);
done
();
done
();
});
});
});
});
...
@@ -234,12 +236,10 @@ describe('Issuable Time Tracker', () => {
...
@@ -234,12 +236,10 @@ describe('Issuable Time Tracker', () => {
const
closeHelpButton
=
()
=>
vm
.
$el
.
querySelector
(
'
.close-help-button
'
);
const
closeHelpButton
=
()
=>
vm
.
$el
.
querySelector
(
'
.close-help-button
'
);
const
helpPane
=
()
=>
vm
.
$el
.
querySelector
(
'
.time-tracking-help-state
'
);
const
helpPane
=
()
=>
vm
.
$el
.
querySelector
(
'
.time-tracking-help-state
'
);
beforeEach
(
done
=>
{
beforeEach
(
()
=>
{
initTimeTrackingComponent
({
timeEstimate
:
0
,
timeSpent
:
0
});
initTimeTrackingComponent
({
timeEstimate
:
0
,
timeSpent
:
0
});
Vue
.
nextTick
()
return
vm
.
$nextTick
();
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
should not show the "Help" pane by default
'
,
()
=>
{
it
(
'
should not show the "Help" pane by default
'
,
()
=>
{
...
@@ -247,16 +247,17 @@ describe('Issuable Time Tracker', () => {
...
@@ -247,16 +247,17 @@ describe('Issuable Time Tracker', () => {
expect
(
helpPane
()).
toBeNull
();
expect
(
helpPane
()).
toBeNull
();
});
});
it
(
'
should show the "Help" pane when help button is clicked
'
,
done
=>
{
it
(
'
should show the "Help" pane when help button is clicked
'
,
()
=>
{
helpButton
().
click
();
helpButton
().
click
();
Vue
.
nextTick
()
return
vm
.
$nextTick
().
then
(()
=>
{
.
then
(()
=>
{
expect
(
vm
.
showHelpState
).
toBe
(
true
);
expect
(
vm
.
showHelpState
).
toBe
(
true
);
expect
(
helpPane
()).
toBeVisible
();
// let animations run
})
jest
.
advanceTimersByTime
(
500
);
.
then
(
done
)
.
catch
(
done
.
fail
);
expect
(
helpPane
()).
toBeVisible
();
});
});
});
it
(
'
should not show the "Help" pane when help button is clicked and then closed
'
,
done
=>
{
it
(
'
should not show the "Help" pane when help button is clicked and then closed
'
,
done
=>
{
...
...
spec/
javascripts
/sidebar/lock/lock_issue_sidebar_spec.js
→
spec/
frontend
/sidebar/lock/lock_issue_sidebar_spec.js
View file @
23e014a9
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
mockTracking
,
triggerEvent
}
from
'
spec/
helpers/tracking_helper
'
;
import
{
mockTracking
,
triggerEvent
}
from
'
helpers/tracking_helper
'
;
import
lockIssueSidebar
from
'
~/sidebar/components/lock/lock_issue_sidebar.vue
'
;
import
lockIssueSidebar
from
'
~/sidebar/components/lock/lock_issue_sidebar.vue
'
;
describe
(
'
LockIssueSidebar
'
,
()
=>
{
describe
(
'
LockIssueSidebar
'
,
()
=>
{
...
@@ -61,7 +61,7 @@ describe('LockIssueSidebar', () => {
...
@@ -61,7 +61,7 @@ describe('LockIssueSidebar', () => {
});
});
it
(
'
tracks an event when "Edit" is clicked
'
,
()
=>
{
it
(
'
tracks an event when "Edit" is clicked
'
,
()
=>
{
const
spy
=
mockTracking
(
'
_category_
'
,
vm1
.
$el
,
spyOn
);
const
spy
=
mockTracking
(
'
_category_
'
,
vm1
.
$el
,
jest
.
spyOn
);
triggerEvent
(
'
.lock-edit
'
);
triggerEvent
(
'
.lock-edit
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
click_edit_button
'
,
{
expect
(
spy
).
toHaveBeenCalledWith
(
'
_category_
'
,
'
click_edit_button
'
,
{
...
@@ -77,7 +77,7 @@ describe('LockIssueSidebar', () => {
...
@@ -77,7 +77,7 @@ describe('LockIssueSidebar', () => {
expect
(
vm1
.
isLockDialogOpen
).
toBe
(
true
);
expect
(
vm1
.
isLockDialogOpen
).
toBe
(
true
);
set
Timeout
(()
=>
{
set
Immediate
(()
=>
{
expect
(
vm1
.
$el
.
innerHTML
.
includes
(
'
Unlock this issue?
'
)).
toBe
(
true
);
expect
(
vm1
.
$el
.
innerHTML
.
includes
(
'
Unlock this issue?
'
)).
toBe
(
true
);
done
();
done
();
...
...
spec/
javascripts
/sidebar/sidebar_move_issue_spec.js
→
spec/
frontend
/sidebar/sidebar_move_issue_spec.js
View file @
23e014a9
...
@@ -7,15 +7,16 @@ import SidebarService from '~/sidebar/services/sidebar_service';
...
@@ -7,15 +7,16 @@ import SidebarService from '~/sidebar/services/sidebar_service';
import
SidebarMoveIssue
from
'
~/sidebar/lib/sidebar_move_issue
'
;
import
SidebarMoveIssue
from
'
~/sidebar/lib/sidebar_move_issue
'
;
import
Mock
from
'
./mock_data
'
;
import
Mock
from
'
./mock_data
'
;
describe
(
'
SidebarMoveIssue
'
,
function
()
{
describe
(
'
SidebarMoveIssue
'
,
()
=>
{
let
mock
;
let
mock
;
const
test
=
{};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
const
mockData
=
Mock
.
responseMap
.
GET
[
'
/autocomplete/projects?project_id=15
'
];
const
mockData
=
Mock
.
responseMap
.
GET
[
'
/autocomplete/projects?project_id=15
'
];
mock
.
onGet
(
'
/autocomplete/projects?project_id=15
'
).
reply
(
200
,
mockData
);
mock
.
onGet
(
'
/autocomplete/projects?project_id=15
'
).
reply
(
200
,
mockData
);
t
his
.
mediator
=
new
SidebarMediator
(
Mock
.
mediator
);
t
est
.
mediator
=
new
SidebarMediator
(
Mock
.
mediator
);
t
his
.
$content
=
$
(
`
t
est
.
$content
=
$
(
`
<div class="dropdown">
<div class="dropdown">
<div class="js-toggle"></div>
<div class="js-toggle"></div>
<div class="dropdown-menu">
<div class="dropdown-menu">
...
@@ -24,15 +25,15 @@ describe('SidebarMoveIssue', function() {
...
@@ -24,15 +25,15 @@ describe('SidebarMoveIssue', function() {
<div class="js-confirm-button"></div>
<div class="js-confirm-button"></div>
</div>
</div>
`
);
`
);
t
his
.
$toggleButton
=
this
.
$content
.
find
(
'
.js-toggle
'
);
t
est
.
$toggleButton
=
test
.
$content
.
find
(
'
.js-toggle
'
);
t
his
.
$confirmButton
=
this
.
$content
.
find
(
'
.js-confirm-button
'
);
t
est
.
$confirmButton
=
test
.
$content
.
find
(
'
.js-confirm-button
'
);
t
his
.
sidebarMoveIssue
=
new
SidebarMoveIssue
(
t
est
.
sidebarMoveIssue
=
new
SidebarMoveIssue
(
t
his
.
mediator
,
t
est
.
mediator
,
t
his
.
$toggleButton
,
t
est
.
$toggleButton
,
t
his
.
$confirmButton
,
t
est
.
$confirmButton
,
);
);
t
his
.
sidebarMoveIssue
.
init
();
t
est
.
sidebarMoveIssue
.
init
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -40,46 +41,46 @@ describe('SidebarMoveIssue', function() {
...
@@ -40,46 +41,46 @@ describe('SidebarMoveIssue', function() {
SidebarStore
.
singleton
=
null
;
SidebarStore
.
singleton
=
null
;
SidebarMediator
.
singleton
=
null
;
SidebarMediator
.
singleton
=
null
;
t
his
.
sidebarMoveIssue
.
destroy
();
t
est
.
sidebarMoveIssue
.
destroy
();
mock
.
restore
();
mock
.
restore
();
});
});
describe
(
'
init
'
,
()
=>
{
describe
(
'
init
'
,
()
=>
{
it
(
'
should initialize the dropdown and listeners
'
,
()
=>
{
it
(
'
should initialize the dropdown and listeners
'
,
()
=>
{
spyOn
(
this
.
sidebarMoveIssue
,
'
initDropdown
'
);
jest
.
spyOn
(
test
.
sidebarMoveIssue
,
'
initDropdown
'
).
mockImplementation
(()
=>
{}
);
spyOn
(
this
.
sidebarMoveIssue
,
'
addEventListeners
'
);
jest
.
spyOn
(
test
.
sidebarMoveIssue
,
'
addEventListeners
'
).
mockImplementation
(()
=>
{}
);
t
his
.
sidebarMoveIssue
.
init
();
t
est
.
sidebarMoveIssue
.
init
();
expect
(
t
his
.
sidebarMoveIssue
.
initDropdown
).
toHaveBeenCalled
();
expect
(
t
est
.
sidebarMoveIssue
.
initDropdown
).
toHaveBeenCalled
();
expect
(
t
his
.
sidebarMoveIssue
.
addEventListeners
).
toHaveBeenCalled
();
expect
(
t
est
.
sidebarMoveIssue
.
addEventListeners
).
toHaveBeenCalled
();
});
});
});
});
describe
(
'
destroy
'
,
()
=>
{
describe
(
'
destroy
'
,
()
=>
{
it
(
'
should remove the listeners
'
,
()
=>
{
it
(
'
should remove the listeners
'
,
()
=>
{
spyOn
(
this
.
sidebarMoveIssue
,
'
removeEventListeners
'
);
jest
.
spyOn
(
test
.
sidebarMoveIssue
,
'
removeEventListeners
'
).
mockImplementation
(()
=>
{}
);
t
his
.
sidebarMoveIssue
.
destroy
();
t
est
.
sidebarMoveIssue
.
destroy
();
expect
(
t
his
.
sidebarMoveIssue
.
removeEventListeners
).
toHaveBeenCalled
();
expect
(
t
est
.
sidebarMoveIssue
.
removeEventListeners
).
toHaveBeenCalled
();
});
});
});
});
describe
(
'
initDropdown
'
,
()
=>
{
describe
(
'
initDropdown
'
,
()
=>
{
it
(
'
should initialize the gl_dropdown
'
,
()
=>
{
it
(
'
should initialize the gl_dropdown
'
,
()
=>
{
spyOn
(
$
.
fn
,
'
glDropdown
'
);
jest
.
spyOn
(
$
.
fn
,
'
glDropdown
'
).
mockImplementation
(()
=>
{}
);
t
his
.
sidebarMoveIssue
.
initDropdown
();
t
est
.
sidebarMoveIssue
.
initDropdown
();
expect
(
$
.
fn
.
glDropdown
).
toHaveBeenCalled
();
expect
(
$
.
fn
.
glDropdown
).
toHaveBeenCalled
();
});
});
it
(
'
escapes html from project name
'
,
done
=>
{
it
(
'
escapes html from project name
'
,
done
=>
{
t
his
.
$toggleButton
.
dropdown
(
'
toggle
'
);
t
est
.
$toggleButton
.
dropdown
(
'
toggle
'
);
set
Timeout
(()
=>
{
set
Immediate
(()
=>
{
expect
(
t
his
.
$content
.
find
(
'
.js-move-issue-dropdown-item
'
)[
1
].
innerHTML
.
trim
()).
toEqual
(
expect
(
t
est
.
$content
.
find
(
'
.js-move-issue-dropdown-item
'
)[
1
].
innerHTML
.
trim
()).
toEqual
(
'
<img src=x onerror=alert(document.domain)> foo / bar
'
,
'
<img src=x onerror=alert(document.domain)> foo / bar
'
,
);
);
done
();
done
();
...
@@ -89,78 +90,78 @@ describe('SidebarMoveIssue', function() {
...
@@ -89,78 +90,78 @@ describe('SidebarMoveIssue', function() {
describe
(
'
onConfirmClicked
'
,
()
=>
{
describe
(
'
onConfirmClicked
'
,
()
=>
{
it
(
'
should move the issue with valid project ID
'
,
()
=>
{
it
(
'
should move the issue with valid project ID
'
,
()
=>
{
spyOn
(
this
.
mediator
,
'
moveIssue
'
).
and
.
r
eturnValue
(
Promise
.
resolve
());
jest
.
spyOn
(
test
.
mediator
,
'
moveIssue
'
).
mockR
eturnValue
(
Promise
.
resolve
());
t
his
.
mediator
.
setMoveToProjectId
(
7
);
t
est
.
mediator
.
setMoveToProjectId
(
7
);
t
his
.
sidebarMoveIssue
.
onConfirmClicked
();
t
est
.
sidebarMoveIssue
.
onConfirmClicked
();
expect
(
t
his
.
mediator
.
moveIssue
).
toHaveBeenCalled
();
expect
(
t
est
.
mediator
.
moveIssue
).
toHaveBeenCalled
();
expect
(
t
his
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeTruthy
();
expect
(
t
est
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeTruthy
();
expect
(
t
his
.
$confirmButton
.
hasClass
(
'
is-loading
'
)).
toBe
(
true
);
expect
(
t
est
.
$confirmButton
.
hasClass
(
'
is-loading
'
)).
toBe
(
true
);
});
});
it
(
'
should remove loading state from confirm button on failure
'
,
done
=>
{
it
(
'
should remove loading state from confirm button on failure
'
,
done
=>
{
spyOn
(
window
,
'
Flash
'
);
jest
.
spyOn
(
window
,
'
Flash
'
).
mockImplementation
(()
=>
{}
);
spyOn
(
this
.
mediator
,
'
moveIssue
'
).
and
.
r
eturnValue
(
Promise
.
reject
());
jest
.
spyOn
(
test
.
mediator
,
'
moveIssue
'
).
mockR
eturnValue
(
Promise
.
reject
());
t
his
.
mediator
.
setMoveToProjectId
(
7
);
t
est
.
mediator
.
setMoveToProjectId
(
7
);
t
his
.
sidebarMoveIssue
.
onConfirmClicked
();
t
est
.
sidebarMoveIssue
.
onConfirmClicked
();
expect
(
t
his
.
mediator
.
moveIssue
).
toHaveBeenCalled
();
expect
(
t
est
.
mediator
.
moveIssue
).
toHaveBeenCalled
();
// Wait for the move issue request to fail
// Wait for the move issue request to fail
set
Timeout
(()
=>
{
set
Immediate
(()
=>
{
expect
(
window
.
Flash
).
toHaveBeenCalled
();
expect
(
window
.
Flash
).
toHaveBeenCalled
();
expect
(
t
his
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeFalsy
();
expect
(
t
est
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeFalsy
();
expect
(
t
his
.
$confirmButton
.
hasClass
(
'
is-loading
'
)).
toBe
(
false
);
expect
(
t
est
.
$confirmButton
.
hasClass
(
'
is-loading
'
)).
toBe
(
false
);
done
();
done
();
});
});
});
});
it
(
'
should not move the issue with id=0
'
,
()
=>
{
it
(
'
should not move the issue with id=0
'
,
()
=>
{
spyOn
(
this
.
mediator
,
'
moveIssue
'
);
jest
.
spyOn
(
test
.
mediator
,
'
moveIssue
'
).
mockImplementation
(()
=>
{}
);
t
his
.
mediator
.
setMoveToProjectId
(
0
);
t
est
.
mediator
.
setMoveToProjectId
(
0
);
t
his
.
sidebarMoveIssue
.
onConfirmClicked
();
t
est
.
sidebarMoveIssue
.
onConfirmClicked
();
expect
(
t
his
.
mediator
.
moveIssue
).
not
.
toHaveBeenCalled
();
expect
(
t
est
.
mediator
.
moveIssue
).
not
.
toHaveBeenCalled
();
});
});
});
});
it
(
'
should set moveToProjectId on dropdown item "No project" click
'
,
done
=>
{
it
(
'
should set moveToProjectId on dropdown item "No project" click
'
,
done
=>
{
spyOn
(
this
.
mediator
,
'
setMoveToProjectId
'
);
jest
.
spyOn
(
test
.
mediator
,
'
setMoveToProjectId
'
).
mockImplementation
(()
=>
{}
);
// Open the dropdown
// Open the dropdown
t
his
.
$toggleButton
.
dropdown
(
'
toggle
'
);
t
est
.
$toggleButton
.
dropdown
(
'
toggle
'
);
// Wait for the autocomplete request to finish
// Wait for the autocomplete request to finish
set
Timeout
(()
=>
{
set
Immediate
(()
=>
{
t
his
.
$content
t
est
.
$content
.
find
(
'
.js-move-issue-dropdown-item
'
)
.
find
(
'
.js-move-issue-dropdown-item
'
)
.
eq
(
0
)
.
eq
(
0
)
.
trigger
(
'
click
'
);
.
trigger
(
'
click
'
);
expect
(
t
his
.
mediator
.
setMoveToProjectId
).
toHaveBeenCalledWith
(
0
);
expect
(
t
est
.
mediator
.
setMoveToProjectId
).
toHaveBeenCalledWith
(
0
);
expect
(
t
his
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeTruthy
();
expect
(
t
est
.
$confirmButton
.
prop
(
'
disabled
'
)).
toBeTruthy
();
done
();
done
();
}
,
0
);
});
});
});
it
(
'
should set moveToProjectId on dropdown item click
'
,
done
=>
{
it
(
'
should set moveToProjectId on dropdown item click
'
,
done
=>
{
spyOn
(
this
.
mediator
,
'
setMoveToProjectId
'
);
jest
.
spyOn
(
test
.
mediator
,
'
setMoveToProjectId
'
).
mockImplementation
(()
=>
{}
);
// Open the dropdown
// Open the dropdown
t
his
.
$toggleButton
.
dropdown
(
'
toggle
'
);
t
est
.
$toggleButton
.
dropdown
(
'
toggle
'
);
// Wait for the autocomplete request to finish
// Wait for the autocomplete request to finish
set
Timeout
(()
=>
{
set
Immediate
(()
=>
{
t
his
.
$content
t
est
.
$content
.
find
(
'
.js-move-issue-dropdown-item
'
)
.
find
(
'
.js-move-issue-dropdown-item
'
)
.
eq
(
1
)
.
eq
(
1
)
.
trigger
(
'
click
'
);
.
trigger
(
'
click
'
);
expect
(
t
his
.
mediator
.
setMoveToProjectId
).
toHaveBeenCalledWith
(
20
);
expect
(
t
est
.
mediator
.
setMoveToProjectId
).
toHaveBeenCalledWith
(
20
);
expect
(
t
his
.
$confirmButton
.
attr
(
'
disabled
'
)).
toBe
(
undefined
);
expect
(
t
est
.
$confirmButton
.
attr
(
'
disabled
'
)).
toBe
(
undefined
);
done
();
done
();
}
,
0
);
});
});
});
});
});
spec/javascripts/sidebar/mock_data.js
deleted
100644 → 0
View file @
454c8f25
// No new code should be added to this file. Instead, modify the
// file this one re-exports from. For more detail about why, see:
// https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31349
import
mockData
from
'
../../frontend/sidebar/mock_data
'
;
export
default
mockData
;
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