diff options
Diffstat (limited to 'spec/frontend/ide/components/repo_editor_spec.js')
-rw-r--r-- | spec/frontend/ide/components/repo_editor_spec.js | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/spec/frontend/ide/components/repo_editor_spec.js b/spec/frontend/ide/components/repo_editor_spec.js index 3f722c24dbb..b2254de706c 100644 --- a/spec/frontend/ide/components/repo_editor_spec.js +++ b/spec/frontend/ide/components/repo_editor_spec.js @@ -166,11 +166,6 @@ describe('RepoEditor', () => { expect(tabs).toHaveLength(1); expect(tabs.at(0).text()).toBe('Edit'); }); - - it('does not get markdown extension by default', async () => { - await createComponent(); - expect(vm.editor.projectPath).toBeUndefined(); - }); }); describe('when file is markdown', () => { @@ -218,11 +213,6 @@ describe('RepoEditor', () => { }); expect(findTabs()).toHaveLength(0); }); - - it('uses the markdown extension and sets it up correctly', async () => { - await createComponent({ activeFile }); - expect(vm.editor.projectPath).toBe(vm.currentProjectId); - }); }); describe('when file is binary and not raw', () => { @@ -271,6 +261,31 @@ describe('RepoEditor', () => { expect(vm.editor[fn]).toBe(EditorWebIdeExtension.prototype[fn]); }); }); + + it.each` + prefix | activeFile | viewer | shouldHaveMarkdownExtension + ${'Should not'} | ${createActiveFile()} | ${viewerTypes.edit} | ${false} + ${'Should'} | ${dummyFile.markdown} | ${viewerTypes.edit} | ${true} + ${'Should not'} | ${dummyFile.empty} | ${viewerTypes.edit} | ${false} + ${'Should not'} | ${createActiveFile()} | ${viewerTypes.diff} | ${false} + ${'Should not'} | ${dummyFile.markdown} | ${viewerTypes.diff} | ${false} + ${'Should not'} | ${dummyFile.empty} | ${viewerTypes.diff} | ${false} + ${'Should not'} | ${createActiveFile()} | ${viewerTypes.mr} | ${false} + ${'Should not'} | ${dummyFile.markdown} | ${viewerTypes.mr} | ${false} + ${'Should not'} | ${dummyFile.empty} | ${viewerTypes.mr} | ${false} + `( + '$prefix install markdown extension for $activeFile.name in $viewer viewer', + async ({ activeFile, viewer, shouldHaveMarkdownExtension } = {}) => { + await createComponent({ state: { viewer }, activeFile }); + if (shouldHaveMarkdownExtension) { + expect(vm.editor.projectPath).toBe(vm.currentProjectId); + expect(vm.editor.togglePreview).toBeDefined(); + } else { + expect(vm.editor.projectPath).toBeUndefined(); + expect(vm.editor.togglePreview).toBeUndefined(); + } + }, + ); }); describe('setupEditor', () => { |