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/static_site_editor/pages/home_spec.js')
-rw-r--r--spec/frontend/static_site_editor/pages/home_spec.js28
1 files changed, 12 insertions, 16 deletions
diff --git a/spec/frontend/static_site_editor/pages/home_spec.js b/spec/frontend/static_site_editor/pages/home_spec.js
index eb056469603..6571d295c36 100644
--- a/spec/frontend/static_site_editor/pages/home_spec.js
+++ b/spec/frontend/static_site_editor/pages/home_spec.js
@@ -1,4 +1,5 @@
-import { shallowMount, createLocalVue } from '@vue/test-utils';
+import { shallowMount } from '@vue/test-utils';
+import { nextTick } from 'vue';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
import EditArea from '~/static_site_editor/components/edit_area.vue';
import EditMetaModal from '~/static_site_editor/components/edit_meta_modal.vue';
@@ -29,8 +30,6 @@ import {
imageRoot,
} from '../mock_data';
-const localVue = createLocalVue();
-
describe('static_site_editor/pages/home', () => {
let wrapper;
let store;
@@ -78,7 +77,6 @@ describe('static_site_editor/pages/home', () => {
const buildWrapper = (data = {}) => {
wrapper = shallowMount(Home, {
- localVue,
store,
mocks: {
$apollo,
@@ -182,7 +180,7 @@ describe('static_site_editor/pages/home', () => {
});
describe('when preparing submission', () => {
- it('calls the show method when the edit-area submit event is emitted', () => {
+ it('calls the show method when the edit-area submit event is emitted', async () => {
buildWrapper();
const mockInstance = { show: jest.fn() };
@@ -190,9 +188,8 @@ describe('static_site_editor/pages/home', () => {
findEditArea().vm.$emit('submit', { content });
- return wrapper.vm.$nextTick().then(() => {
- expect(mockInstance.show).toHaveBeenCalled();
- });
+ await nextTick();
+ expect(mockInstance.show).toHaveBeenCalled();
});
});
@@ -203,13 +200,13 @@ describe('static_site_editor/pages/home', () => {
.mockRejectedValueOnce(new Error(submitChangesError));
};
- beforeEach(() => {
+ beforeEach(async () => {
setupMutateMock();
buildWrapper({ content });
findEditMetaModal().vm.$emit('primary', mergeRequestMeta);
- return wrapper.vm.$nextTick();
+ await nextTick();
});
it('displays submit changes error message', () => {
@@ -224,12 +221,11 @@ describe('static_site_editor/pages/home', () => {
expect(mutateMock).toHaveBeenCalled();
});
- it('hides submit changes error message when dismiss button is clicked', () => {
+ it('hides submit changes error message when dismiss button is clicked', async () => {
findSubmitChangesError().vm.$emit('dismiss');
- return wrapper.vm.$nextTick().then(() => {
- expect(findSubmitChangesError().exists()).toBe(false);
- });
+ await nextTick();
+ expect(findSubmitChangesError().exists()).toBe(false);
});
});
@@ -237,7 +233,7 @@ describe('static_site_editor/pages/home', () => {
const newContent = `new ${content}`;
const formattedMarkdown = `formatted ${content}`;
- beforeEach(() => {
+ beforeEach(async () => {
mutateMock.mockResolvedValueOnce(hasSubmittedChangesMutationPayload).mockResolvedValueOnce({
data: {
submitContentChanges: savedContentMeta,
@@ -252,7 +248,7 @@ describe('static_site_editor/pages/home', () => {
findEditMetaModal().vm.$emit('primary', mergeRequestMeta);
- return wrapper.vm.$nextTick();
+ await nextTick();
});
it('dispatches hasSubmittedChanges mutation', () => {