diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 00:09:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-05 00:09:14 +0300 |
commit | ceb5cdd5c3293d290c1ae42a86175ac4f51b4408 (patch) | |
tree | 340743b21d708a6c06c5d402c0b697d8b89d9b06 /spec/frontend/vue_shared | |
parent | bd979acf95124119d41f75d34cab231229f4dd81 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared')
-rw-r--r-- | spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js index dec2327db0f..d32e148ef79 100644 --- a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js +++ b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js @@ -62,10 +62,19 @@ describe('vue_shared/component/markdown/markdown_editor', () => { }, }); }; + + const ContentEditorStub = stubComponent(ContentEditor); + const findMarkdownField = () => wrapper.findComponent(MarkdownField); const findTextarea = () => wrapper.find('textarea'); const findLocalStorageSync = () => wrapper.findComponent(LocalStorageSync); - const findContentEditor = () => wrapper.findComponent(ContentEditor); + const findContentEditor = () => { + const result = wrapper.findComponent(ContentEditor); + + // In Vue.js 3 there are nuances stubbing component with custom stub on mount + // So we try to search for stub also + return result.exists() ? result : wrapper.findComponent(ContentEditorStub); + }; const enableContentEditor = async () => { findMarkdownField().vm.$emit('enableContentEditor'); @@ -185,7 +194,7 @@ describe('vue_shared/component/markdown/markdown_editor', () => { it('autosizes the textarea when the value changes', async () => { buildWrapper(); await findTextarea().setValue('Lots of newlines\n\n\n\n\n\n\nMore content\n\n\nand newlines'); - + await nextTick(); expect(Autosize.update).toHaveBeenCalled(); }); @@ -276,7 +285,7 @@ describe('vue_shared/component/markdown/markdown_editor', () => { it(`emits ${EDITING_MODE_MARKDOWN_FIELD} event when enableMarkdownEditor emitted from content editor`, async () => { buildWrapper({ - stubs: { ContentEditor: stubComponent(ContentEditor) }, + stubs: { ContentEditor: ContentEditorStub }, }); await enableContentEditor(); @@ -383,7 +392,7 @@ describe('vue_shared/component/markdown/markdown_editor', () => { beforeEach(() => { buildWrapper({ propsData: { autofocus: true }, - stubs: { ContentEditor: stubComponent(ContentEditor) }, + stubs: { ContentEditor: ContentEditorStub }, }); }); |