Commit 35c1f28b authored by Lee Tickett's avatar Lee Tickett Committed by Fatih Acet

Remove done callbacks from vue components markdown

parent f556e3de
---
title: Remove done callbacks from vue_shared/components/markdown
merge_request: 16842
author: Lee Tickett
type: other
...@@ -5,7 +5,7 @@ import headerComponent from '~/vue_shared/components/markdown/header.vue'; ...@@ -5,7 +5,7 @@ import headerComponent from '~/vue_shared/components/markdown/header.vue';
describe('Markdown field header component', () => { describe('Markdown field header component', () => {
let vm; let vm;
beforeEach(done => { beforeEach(() => {
const Component = Vue.extend(headerComponent); const Component = Vue.extend(headerComponent);
vm = new Component({ vm = new Component({
...@@ -13,8 +13,6 @@ describe('Markdown field header component', () => { ...@@ -13,8 +13,6 @@ describe('Markdown field header component', () => {
previewMarkdown: false, previewMarkdown: false,
}, },
}).$mount(); }).$mount();
Vue.nextTick(done);
}); });
it('renders markdown header buttons', () => { it('renders markdown header buttons', () => {
...@@ -42,13 +40,11 @@ describe('Markdown field header component', () => { ...@@ -42,13 +40,11 @@ describe('Markdown field header component', () => {
expect(vm.$el.querySelector('li:nth-child(1)').classList.contains('active')).toBeTruthy(); expect(vm.$el.querySelector('li:nth-child(1)').classList.contains('active')).toBeTruthy();
}); });
it('renders `preview` link as active when previewMarkdown is true', done => { it('renders `preview` link as active when previewMarkdown is true', () => {
vm.previewMarkdown = true; vm.previewMarkdown = true;
Vue.nextTick(() => { Vue.nextTick(() => {
expect(vm.$el.querySelector('li:nth-child(2)').classList.contains('active')).toBeTruthy(); expect(vm.$el.querySelector('li:nth-child(2)').classList.contains('active')).toBeTruthy();
done();
}); });
}); });
......
...@@ -64,12 +64,10 @@ describe('Suggestion Diff component', () => { ...@@ -64,12 +64,10 @@ describe('Suggestion Diff component', () => {
}); });
describe('when apply suggestion is clicked', () => { describe('when apply suggestion is clicked', () => {
beforeEach(done => { beforeEach(() => {
createComponent(); createComponent();
findApplyButton().vm.$emit('click'); findApplyButton().vm.$emit('click');
wrapper.vm.$nextTick(done);
}); });
it('emits apply', () => { it('emits apply', () => {
...@@ -88,19 +86,15 @@ describe('Suggestion Diff component', () => { ...@@ -88,19 +86,15 @@ describe('Suggestion Diff component', () => {
expect(wrapper.text()).toContain('Applying suggestion'); expect(wrapper.text()).toContain('Applying suggestion');
}); });
it('when callback of apply is called, hides loading', done => { it('when callback of apply is called, hides loading', () => {
const [callback] = wrapper.emitted().apply[0]; const [callback] = wrapper.emitted().apply[0];
callback(); callback();
wrapper.vm return wrapper.vm.$nextTick().then(() => {
.$nextTick() expect(findApplyButton().exists()).toBe(true);
.then(() => { expect(findLoading().exists()).toBe(false);
expect(findApplyButton().exists()).toBe(true); });
expect(findLoading().exists()).toBe(false);
})
.then(done)
.catch(done.fail);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment