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/notes/components')
-rw-r--r--spec/frontend/notes/components/comment_form_spec.js14
-rw-r--r--spec/frontend/notes/components/discussion_notes_spec.js14
-rw-r--r--spec/frontend/notes/components/noteable_note_spec.js7
3 files changed, 20 insertions, 15 deletions
diff --git a/spec/frontend/notes/components/comment_form_spec.js b/spec/frontend/notes/components/comment_form_spec.js
index 537622b7918..bb79b43205b 100644
--- a/spec/frontend/notes/components/comment_form_spec.js
+++ b/spec/frontend/notes/components/comment_form_spec.js
@@ -7,7 +7,7 @@ import Vuex from 'vuex';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import batchComments from '~/batch_comments/stores/modules/batch_comments';
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
-import { deprecatedCreateFlash as flash } from '~/flash';
+import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils';
import CommentForm from '~/notes/components/comment_form.vue';
import * as constants from '~/notes/constants';
@@ -464,9 +464,9 @@ describe('issue_comment_form component', () => {
await wrapper.vm.$nextTick;
await wrapper.vm.$nextTick;
- expect(flash).toHaveBeenCalledWith(
- `Something went wrong while closing the ${type}. Please try again later.`,
- );
+ expect(createFlash).toHaveBeenCalledWith({
+ message: `Something went wrong while closing the ${type}. Please try again later.`,
+ });
});
});
@@ -500,9 +500,9 @@ describe('issue_comment_form component', () => {
await wrapper.vm.$nextTick;
await wrapper.vm.$nextTick;
- expect(flash).toHaveBeenCalledWith(
- `Something went wrong while reopening the ${type}. Please try again later.`,
- );
+ expect(createFlash).toHaveBeenCalledWith({
+ message: `Something went wrong while reopening the ${type}. Please try again later.`,
+ });
});
});
diff --git a/spec/frontend/notes/components/discussion_notes_spec.js b/spec/frontend/notes/components/discussion_notes_spec.js
index cd24b9afbdf..59ac75f00e6 100644
--- a/spec/frontend/notes/components/discussion_notes_spec.js
+++ b/spec/frontend/notes/components/discussion_notes_spec.js
@@ -1,5 +1,5 @@
import { getByRole } from '@testing-library/dom';
-import { shallowMount } from '@vue/test-utils';
+import { shallowMount, mount } from '@vue/test-utils';
import '~/behaviors/markdown/render_gfm';
import DiscussionNotes from '~/notes/components/discussion_notes.vue';
import NoteableNote from '~/notes/components/noteable_note.vue';
@@ -23,8 +23,8 @@ describe('DiscussionNotes', () => {
let wrapper;
const getList = () => getByRole(wrapper.element, 'list');
- const createComponent = (props) => {
- wrapper = shallowMount(DiscussionNotes, {
+ const createComponent = (props, mountingMethod = shallowMount) => {
+ wrapper = mountingMethod(DiscussionNotes, {
store,
propsData: {
discussion: discussionMock,
@@ -33,7 +33,11 @@ describe('DiscussionNotes', () => {
...props,
},
scopedSlots: {
- footer: '<p slot-scope="{ showReplies }">showReplies:{{showReplies}}</p>',
+ footer: `
+ <template #default="{ showReplies }">
+ <p>showReplies:{{ showReplies }}</p>,
+ </template>
+ `,
},
slots: {
'avatar-badge': '<span class="avatar-badge-slot-content" />',
@@ -112,7 +116,7 @@ describe('DiscussionNotes', () => {
});
it('passes down avatar-badge slot content', () => {
- createComponent();
+ createComponent({}, mount);
expect(wrapper.find('.avatar-badge-slot-content').exists()).toBe(true);
});
});
diff --git a/spec/frontend/notes/components/noteable_note_spec.js b/spec/frontend/notes/components/noteable_note_spec.js
index 7444c441e06..f217dfd2e48 100644
--- a/spec/frontend/notes/components/noteable_note_spec.js
+++ b/spec/frontend/notes/components/noteable_note_spec.js
@@ -1,5 +1,4 @@
import { mount } from '@vue/test-utils';
-import { escape } from 'lodash';
import Vue from 'vue';
import Vuex from 'vuex';
@@ -263,7 +262,9 @@ describe('issue_note', () => {
await waitForPromises();
expect(alertSpy).not.toHaveBeenCalled();
- expect(wrapper.vm.note.note_html).toBe(escape(noteBody));
+ expect(wrapper.vm.note.note_html).toBe(
+ '<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"></p>\n',
+ );
});
});
@@ -291,7 +292,7 @@ describe('issue_note', () => {
await wrapper.vm.$nextTick();
let noteBodyProps = noteBody.props();
- expect(noteBodyProps.note.note_html).toBe(updatedText);
+ expect(noteBodyProps.note.note_html).toBe(`<p>${updatedText}</p>\n`);
noteBody.vm.$emit('cancelForm');
await wrapper.vm.$nextTick();