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:
Diffstat (limited to 'spec/frontend/issues/show/components/title_spec.js')
-rw-r--r--spec/frontend/issues/show/components/title_spec.js46
1 files changed, 21 insertions, 25 deletions
diff --git a/spec/frontend/issues/show/components/title_spec.js b/spec/frontend/issues/show/components/title_spec.js
index f9026557be2..29b5353ef1c 100644
--- a/spec/frontend/issues/show/components/title_spec.js
+++ b/spec/frontend/issues/show/components/title_spec.js
@@ -1,4 +1,4 @@
-import Vue from 'vue';
+import Vue, { nextTick } from 'vue';
import titleComponent from '~/issues/show/components/title.vue';
import eventHub from '~/issues/show/event_hub';
import Store from '~/issues/show/stores';
@@ -29,36 +29,33 @@ describe('Title component', () => {
expect(vm.$el.querySelector('.title').innerHTML.trim()).toBe('Testing <img>');
});
- it('updates page title when changing titleHtml', () => {
+ it('updates page title when changing titleHtml', async () => {
const spy = jest.spyOn(vm, 'setPageTitle');
vm.titleHtml = 'test';
- return vm.$nextTick().then(() => {
- expect(spy).toHaveBeenCalled();
- });
+ await nextTick();
+ expect(spy).toHaveBeenCalled();
});
- it('animates title changes', () => {
+ it('animates title changes', async () => {
vm.titleHtml = 'test';
- return vm
- .$nextTick()
- .then(() => {
- expect(vm.$el.querySelector('.title').classList).toContain('issue-realtime-pre-pulse');
- jest.runAllTimers();
- return vm.$nextTick();
- })
- .then(() => {
- expect(vm.$el.querySelector('.title').classList).toContain('issue-realtime-trigger-pulse');
- });
+
+ await nextTick();
+
+ expect(vm.$el.querySelector('.title').classList).toContain('issue-realtime-pre-pulse');
+ jest.runAllTimers();
+
+ await nextTick();
+
+ expect(vm.$el.querySelector('.title').classList).toContain('issue-realtime-trigger-pulse');
});
- it('updates page title after changing title', () => {
+ it('updates page title after changing title', async () => {
vm.titleHtml = 'changed';
vm.titleText = 'changed';
- return vm.$nextTick().then(() => {
- expect(document.querySelector('title').textContent.trim()).toContain('changed');
- });
+ await nextTick();
+ expect(document.querySelector('title').textContent.trim()).toContain('changed');
});
describe('inline edit button', () => {
@@ -80,16 +77,15 @@ describe('Title component', () => {
expect(vm.$el.querySelector('.btn-edit')).toBeDefined();
});
- it('should trigger open.form event when clicked', () => {
+ it('should trigger open.form event when clicked', async () => {
jest.spyOn(eventHub, '$emit').mockImplementation(() => {});
vm.showInlineEditButton = true;
vm.canUpdate = true;
- Vue.nextTick(() => {
- vm.$el.querySelector('.btn-edit').click();
+ await nextTick();
+ vm.$el.querySelector('.btn-edit').click();
- expect(eventHub.$emit).toHaveBeenCalledWith('open.form');
- });
+ expect(eventHub.$emit).toHaveBeenCalledWith('open.form');
});
});
});