Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 12:06:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-18 12:06:43 +0300
commit5333cb6c7c960aac58af40c898c87d050d829383 (patch)
tree79cac8f3f0cf63340b3c0c305d2d1e9780f43ea6 /spec/frontend/notes
parent44baf08d4ff4b0d32fecfded843257e2fc49a63c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/notes')
-rw-r--r--spec/frontend/notes/components/note_app_spec.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/frontend/notes/components/note_app_spec.js b/spec/frontend/notes/components/note_app_spec.js
index b0271d30872..3716b349210 100644
--- a/spec/frontend/notes/components/note_app_spec.js
+++ b/spec/frontend/notes/components/note_app_spec.js
@@ -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);
@@ -54,7 +55,9 @@ describe('note_app', () => {
components: {
NotesApp,
},
- template: '<div class="js-vue-notes-event"><notes-app v-bind="$attrs" /></div>',
+ template: `<div class="js-vue-notes-event">
+ <notes-app ref="notesApp" v-bind="$attrs" />
+ </div>`,
},
{
attachToDocument: true,
@@ -313,4 +316,23 @@ describe('note_app', () => {
});
});
});
+
+ describe('mounted', () => {
+ beforeEach(() => {
+ axiosMock.onAny().reply(mockData.getIndividualNoteResponse);
+ wrapper = mountComponent();
+ return waitForDiscussionsRequest();
+ });
+
+ it('should listen hashchange event', () => {
+ const notesApp = wrapper.find(NotesApp);
+ const hash = 'some dummy hash';
+ jest.spyOn(urlUtility, 'getLocationHash').mockReturnValueOnce(hash);
+ const setTargetNoteHash = jest.spyOn(notesApp.vm, 'setTargetNoteHash');
+
+ window.dispatchEvent(new Event('hashchange'), hash);
+
+ expect(setTargetNoteHash).toHaveBeenCalled();
+ });
+ });
});