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
c7433c81
Commit
c7433c81
authored
Nov 15, 2019
by
Winnie Hellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mock setTargetNoteHash instead of handleHashChanged
parent
d8f70c6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
spec/frontend/notes/components/note_app_spec.js
spec/frontend/notes/components/note_app_spec.js
+8
-4
No files found.
spec/frontend/notes/components/note_app_spec.js
View file @
c7433c81
...
...
@@ -10,6 +10,7 @@ import '~/behaviors/markdown/render_gfm';
import
{
setTestTimeout
}
from
'
helpers/timeout
'
;
// TODO: use generated fixture (https://gitlab.com/gitlab-org/gitlab-foss/issues/62491)
import
*
as
mockData
from
'
../../notes/mock_data
'
;
import
*
as
urlUtility
from
'
~/lib/utils/url_utility
'
;
setTestTimeout
(
1000
);
...
...
@@ -324,11 +325,14 @@ describe('note_app', () => {
});
it
(
'
should listen hashchange event
'
,
()
=>
{
wrapper
.
vm
.
$refs
.
notesApp
.
handleHashChanged
=
jest
.
fn
();
// jest.spyOn(wrapper.vm.$refs.notesApp, 'handleHashChanged');
window
.
dispatchEvent
(
new
Event
(
'
hashchange
'
),
'
#foo
'
);
const
notesApp
=
wrapper
.
find
(
NotesApp
);
const
hash
=
'
some dummy hash
'
;
jest
.
spyOn
(
urlUtility
,
'
getLocationHash
'
).
mockReturnValueOnce
(
hash
);
const
setTargetNoteHash
=
jest
.
spyOn
(
notesApp
.
vm
,
'
setTargetNoteHash
'
);
expect
(
wrapper
.
vm
.
$refs
.
notesApp
.
handleHashChanged
).
toHaveBeenCalled
();
window
.
dispatchEvent
(
new
Event
(
'
hashchange
'
),
hash
);
expect
(
setTargetNoteHash
).
toHaveBeenCalled
();
});
});
});
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