diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-05 12:09:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-05 12:09:46 +0000 |
commit | f34077e88198da754b4efecd1ce1d996ce982286 (patch) | |
tree | 24a176ba93be06eee0ee912215fbeb2611ab7872 /spec/frontend/notebook | |
parent | 402c915cb58cfc658ecbdad368e89fb7b3993c1e (diff) | |
download | gitlab-ce-f34077e88198da754b4efecd1ce1d996ce982286.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/notebook')
-rw-r--r-- | spec/frontend/notebook/cells/prompt_spec.js | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/spec/frontend/notebook/cells/prompt_spec.js b/spec/frontend/notebook/cells/prompt_spec.js index 89b2d7b2b90..0cda0c5bc2b 100644 --- a/spec/frontend/notebook/cells/prompt_spec.js +++ b/spec/frontend/notebook/cells/prompt_spec.js @@ -1,52 +1,40 @@ -import Vue, { nextTick } from 'vue'; -import PromptComponent from '~/notebook/cells/prompt.vue'; - -const Component = Vue.extend(PromptComponent); +import { shallowMount } from '@vue/test-utils'; +import Prompt from '~/notebook/cells/prompt.vue'; describe('Prompt component', () => { - let vm; + let wrapper; + + const mountComponent = ({ type }) => shallowMount(Prompt, { propsData: { type, count: 1 } }); + + afterEach(() => { + wrapper.destroy(); + }); describe('input', () => { beforeEach(() => { - vm = new Component({ - propsData: { - type: 'In', - count: 1, - }, - }); - vm.$mount(); - - return nextTick(); + wrapper = mountComponent({ type: 'In' }); }); it('renders in label', () => { - expect(vm.$el.textContent.trim()).toContain('In'); + expect(wrapper.text()).toContain('In'); }); it('renders count', () => { - expect(vm.$el.textContent.trim()).toContain('1'); + expect(wrapper.text()).toContain('1'); }); }); describe('output', () => { beforeEach(() => { - vm = new Component({ - propsData: { - type: 'Out', - count: 1, - }, - }); - vm.$mount(); - - return nextTick(); + wrapper = mountComponent({ type: 'Out' }); }); it('renders in label', () => { - expect(vm.$el.textContent.trim()).toContain('Out'); + expect(wrapper.text()).toContain('Out'); }); it('renders count', () => { - expect(vm.$el.textContent.trim()).toContain('1'); + expect(wrapper.text()).toContain('1'); }); }); }); |