From 0ea3fcec397b69815975647f5e2aa5fe944a8486 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 Jun 2022 11:10:13 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-1-stable-ee --- spec/frontend/notes/components/note_body_spec.js | 35 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'spec/frontend/notes/components/note_body_spec.js') diff --git a/spec/frontend/notes/components/note_body_spec.js b/spec/frontend/notes/components/note_body_spec.js index 378dcb97fab..0f765a8da87 100644 --- a/spec/frontend/notes/components/note_body_spec.js +++ b/spec/frontend/notes/components/note_body_spec.js @@ -1,5 +1,5 @@ -import { shallowMount } from '@vue/test-utils'; import Vuex from 'vuex'; +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { suggestionCommitMessage } from '~/diffs/store/getters'; import NoteBody from '~/notes/components/note_body.vue'; @@ -7,6 +7,7 @@ import NoteAwardsList from '~/notes/components/note_awards_list.vue'; import NoteForm from '~/notes/components/note_form.vue'; import createStore from '~/notes/stores'; import notes from '~/notes/stores/modules/index'; +import { INTERNAL_NOTE_CLASSES } from '~/notes/constants'; import Suggestions from '~/vue_shared/components/markdown/suggestions.vue'; @@ -27,7 +28,7 @@ const createComponent = ({ mockStore.dispatch('setNotesData', notesData); } - return shallowMount(NoteBody, { + return shallowMountExtended(NoteBody, { store: mockStore || store, propsData: { note, @@ -58,6 +59,24 @@ describe('issue_note_body component', () => { expect(wrapper.findComponent(NoteAwardsList).exists()).toBe(true); }); + it('should not have internal note classes', () => { + expect(wrapper.findByTestId('note-internal-container').classes()).not.toEqual( + INTERNAL_NOTE_CLASSES, + ); + }); + + describe('isInternalNote', () => { + beforeEach(() => { + wrapper = createComponent({ props: { isInternalNote: true } }); + }); + + it('should have internal note classes', () => { + expect(wrapper.findByTestId('note-internal-container').classes()).toEqual( + INTERNAL_NOTE_CLASSES, + ); + }); + }); + describe('isEditing', () => { beforeEach(() => { wrapper = createComponent({ props: { isEditing: true } }); @@ -86,6 +105,18 @@ describe('issue_note_body component', () => { // which is defined in `app/assets/javascripts/notes/mixins/autosave.js` expect(wrapper.vm.autosave.key).toEqual(autosaveKey); }); + + describe('isInternalNote', () => { + beforeEach(() => { + wrapper.setProps({ isInternalNote: true }); + }); + + it('should not have internal note classes', () => { + expect(wrapper.findByTestId('note-internal-container').classes()).not.toEqual( + INTERNAL_NOTE_CLASSES, + ); + }); + }); }); describe('commitMessage', () => { -- cgit v1.2.3