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/notebook/cells/prompt_spec.js')
-rw-r--r--spec/frontend/notebook/cells/prompt_spec.js42
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');
});
});
});