Commit e0bc404e authored by Fatih Acet's avatar Fatih Acet

Merge branch 'remove-done-callbacks-from-vue-components-markdown' into 'master'

Remove done callbacks from vue components markdown

Closes #28404

See merge request gitlab-org/gitlab!16842
parents f556e3de 35c1f28b
---
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';
describe('Markdown field header component', () => {
let vm;
beforeEach(done => {
beforeEach(() => {
const Component = Vue.extend(headerComponent);
vm = new Component({
......@@ -13,8 +13,6 @@ describe('Markdown field header component', () => {
previewMarkdown: false,
},
}).$mount();
Vue.nextTick(done);
});
it('renders markdown header buttons', () => {
......@@ -42,13 +40,11 @@ describe('Markdown field header component', () => {
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;
Vue.nextTick(() => {
expect(vm.$el.querySelector('li:nth-child(2)').classList.contains('active')).toBeTruthy();
done();
});
});
......
......@@ -64,12 +64,10 @@ describe('Suggestion Diff component', () => {
});
describe('when apply suggestion is clicked', () => {
beforeEach(done => {
beforeEach(() => {
createComponent();
findApplyButton().vm.$emit('click');
wrapper.vm.$nextTick(done);
});
it('emits apply', () => {
......@@ -88,19 +86,15 @@ describe('Suggestion Diff component', () => {
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];
callback();
wrapper.vm
.$nextTick()
.then(() => {
expect(findApplyButton().exists()).toBe(true);
expect(findLoading().exists()).toBe(false);
})
.then(done)
.catch(done.fail);
return wrapper.vm.$nextTick().then(() => {
expect(findApplyButton().exists()).toBe(true);
expect(findLoading().exists()).toBe(false);
});
});
});
});
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