diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 21:09:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-16 21:09:43 +0300 |
commit | 0122d00cac3c058508a2fcb258f12ecfb7bc9055 (patch) | |
tree | b2a0e138ed4113e80588df57b542dc76d5360e2b /spec/frontend/editor/source_editor_markdown_ext_spec.js | |
parent | f1357e5566b2c1f4f5e7b933b72a2d24431905e9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/editor/source_editor_markdown_ext_spec.js')
-rw-r--r-- | spec/frontend/editor/source_editor_markdown_ext_spec.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/frontend/editor/source_editor_markdown_ext_spec.js b/spec/frontend/editor/source_editor_markdown_ext_spec.js index 3e8c287df2f..33e4b4bfc8e 100644 --- a/spec/frontend/editor/source_editor_markdown_ext_spec.js +++ b/spec/frontend/editor/source_editor_markdown_ext_spec.js @@ -1,7 +1,9 @@ import MockAdapter from 'axios-mock-adapter'; import { Range, Position } from 'monaco-editor'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; +import { EXTENSION_MARKDOWN_BUTTONS } from '~/editor/constants'; import { EditorMarkdownExtension } from '~/editor/extensions/source_editor_markdown_ext'; +import { ToolbarExtension } from '~/editor/extensions/source_editor_toolbar_ext'; import SourceEditor from '~/editor/source_editor'; import axios from '~/lib/utils/axios_utils'; @@ -36,7 +38,7 @@ describe('Markdown Extension for Source Editor', () => { blobPath: markdownPath, blobContent: text, }); - instance.use({ definition: EditorMarkdownExtension }); + instance.use([{ definition: ToolbarExtension }, { definition: EditorMarkdownExtension }]); }); afterEach(() => { @@ -47,6 +49,16 @@ describe('Markdown Extension for Source Editor', () => { resetHTMLFixture(); }); + describe('toolbar', () => { + it('renders all the buttons', () => { + const btns = instance.toolbar.getAllItems(); + expect(btns).toHaveLength(EXTENSION_MARKDOWN_BUTTONS.length); + EXTENSION_MARKDOWN_BUTTONS.forEach((btn, i) => { + expect(btns[i].id).toBe(btn.id); + }); + }); + }); + describe('getSelectedText', () => { it('does not fail if there is no selection and returns the empty string', () => { jest.spyOn(instance, 'getSelection'); |