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/ide/components/terminal')
-rw-r--r--spec/frontend/ide/components/terminal/session_spec.js25
-rw-r--r--spec/frontend/ide/components/terminal/terminal_controls_spec.js15
-rw-r--r--spec/frontend/ide/components/terminal/view_spec.js8
3 files changed, 22 insertions, 26 deletions
diff --git a/spec/frontend/ide/components/terminal/session_spec.js b/spec/frontend/ide/components/terminal/session_spec.js
index 5659a7d15da..6a70ddb46a8 100644
--- a/spec/frontend/ide/components/terminal/session_spec.js
+++ b/spec/frontend/ide/components/terminal/session_spec.js
@@ -1,5 +1,6 @@
import { GlButton } from '@gitlab/ui';
-import { createLocalVue, shallowMount } from '@vue/test-utils';
+import { shallowMount } from '@vue/test-utils';
+import Vue, { nextTick } from 'vue';
import Vuex from 'vuex';
import TerminalSession from '~/ide/components/terminal/session.vue';
import Terminal from '~/ide/components/terminal/terminal.vue';
@@ -13,8 +14,7 @@ import {
const TEST_TERMINAL_PATH = 'terminal/path';
-const localVue = createLocalVue();
-localVue.use(Vuex);
+Vue.use(Vuex);
describe('IDE TerminalSession', () => {
let wrapper;
@@ -33,7 +33,6 @@ describe('IDE TerminalSession', () => {
});
wrapper = shallowMount(TerminalSession, {
- localVue,
store,
...options,
});
@@ -68,32 +67,30 @@ describe('IDE TerminalSession', () => {
});
[STARTING, PENDING, RUNNING].forEach((status) => {
- it(`show stop button when status is ${status}`, () => {
+ it(`show stop button when status is ${status}`, async () => {
state.session = { status };
factory();
const button = findButton();
button.vm.$emit('click');
- return wrapper.vm.$nextTick().then(() => {
- expect(button.text()).toEqual('Stop Terminal');
- expect(actions.stopSession).toHaveBeenCalled();
- });
+ await nextTick();
+ expect(button.text()).toEqual('Stop Terminal');
+ expect(actions.stopSession).toHaveBeenCalled();
});
});
[STOPPING, STOPPED].forEach((status) => {
- it(`show stop button when status is ${status}`, () => {
+ it(`show stop button when status is ${status}`, async () => {
state.session = { status };
factory();
const button = findButton();
button.vm.$emit('click');
- return wrapper.vm.$nextTick().then(() => {
- expect(button.text()).toEqual('Restart Terminal');
- expect(actions.restartSession).toHaveBeenCalled();
- });
+ await nextTick();
+ expect(button.text()).toEqual('Restart Terminal');
+ expect(actions.restartSession).toHaveBeenCalled();
});
});
});
diff --git a/spec/frontend/ide/components/terminal/terminal_controls_spec.js b/spec/frontend/ide/components/terminal/terminal_controls_spec.js
index 416096083f0..71ec0dca89d 100644
--- a/spec/frontend/ide/components/terminal/terminal_controls_spec.js
+++ b/spec/frontend/ide/components/terminal/terminal_controls_spec.js
@@ -1,4 +1,5 @@
import { shallowMount } from '@vue/test-utils';
+import { nextTick } from 'vue';
import ScrollButton from '~/ide/components/jobs/detail/scroll_button.vue';
import TerminalControls from '~/ide/components/terminal/terminal_controls.vue';
@@ -39,27 +40,25 @@ describe('IDE TerminalControls', () => {
);
});
- it('emits "scroll-up" when click up button', () => {
+ it('emits "scroll-up" when click up button', async () => {
factory({ propsData: { canScrollUp: true } });
expect(wrapper.emitted()).toEqual({});
buttons.at(0).vm.$emit('click');
- return wrapper.vm.$nextTick().then(() => {
- expect(wrapper.emitted('scroll-up')).toEqual([[]]);
- });
+ await nextTick();
+ expect(wrapper.emitted('scroll-up')).toEqual([[]]);
});
- it('emits "scroll-down" when click down button', () => {
+ it('emits "scroll-down" when click down button', async () => {
factory({ propsData: { canScrollDown: true } });
expect(wrapper.emitted()).toEqual({});
buttons.at(1).vm.$emit('click');
- return wrapper.vm.$nextTick().then(() => {
- expect(wrapper.emitted('scroll-down')).toEqual([[]]);
- });
+ await nextTick();
+ expect(wrapper.emitted('scroll-down')).toEqual([[]]);
});
});
diff --git a/spec/frontend/ide/components/terminal/view_spec.js b/spec/frontend/ide/components/terminal/view_spec.js
index e97d4d8a73b..49f9513d2ac 100644
--- a/spec/frontend/ide/components/terminal/view_spec.js
+++ b/spec/frontend/ide/components/terminal/view_spec.js
@@ -1,4 +1,5 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
+import { shallowMount } from '@vue/test-utils';
+import Vue from 'vue';
import Vuex from 'vuex';
import waitForPromises from 'helpers/wait_for_promises';
import { TEST_HOST } from 'spec/test_constants';
@@ -9,8 +10,7 @@ import TerminalView from '~/ide/components/terminal/view.vue';
const TEST_HELP_PATH = `${TEST_HOST}/help`;
const TEST_SVG_PATH = `${TEST_HOST}/illustration.svg`;
-const localVue = createLocalVue();
-localVue.use(Vuex);
+Vue.use(Vuex);
describe('IDE TerminalView', () => {
let state;
@@ -30,7 +30,7 @@ describe('IDE TerminalView', () => {
},
});
- wrapper = shallowMount(TerminalView, { localVue, store });
+ wrapper = shallowMount(TerminalView, { store });
// Uses deferred components, so wait for those to load...
await waitForPromises();