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/vue_shared/components/markdown/markdown_editor_spec.js')
-rw-r--r--spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js29
1 files changed, 9 insertions, 20 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 f7e93f45148..625e67c7cc1 100644
--- a/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js
+++ b/spec/frontend/vue_shared/components/markdown/markdown_editor_spec.js
@@ -27,7 +27,7 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
const formFieldAriaLabel = 'Edit your content';
let mock;
- const buildWrapper = ({ propsData = {}, attachTo } = {}) => {
+ const buildWrapper = ({ propsData = {}, attachTo, stubs = {} } = {}) => {
wrapper = mountExtended(MarkdownEditor, {
attachTo,
propsData: {
@@ -45,6 +45,7 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
},
stubs: {
BubbleMenu: stubComponent(BubbleMenu),
+ ...stubs,
},
});
};
@@ -138,9 +139,9 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
expect(wrapper.emitted('input')).toEqual([[newValue]]);
});
- describe('when initOnAutofocus is true', () => {
+ describe('when autofocus is true', () => {
beforeEach(async () => {
- buildWrapper({ attachTo: document.body, propsData: { initOnAutofocus: true } });
+ buildWrapper({ attachTo: document.body, propsData: { autofocus: true } });
await nextTick();
});
@@ -171,7 +172,6 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
renderMarkdown: expect.any(Function),
uploadsPath: window.uploads_path,
markdown: value,
- autofocus: 'end',
}),
);
});
@@ -204,10 +204,12 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
findSegmentedControl().vm.$emit('input', EDITING_MODE_CONTENT_EDITOR);
});
- describe('when initOnAutofocus is true', () => {
+ describe('when autofocus is true', () => {
beforeEach(() => {
- buildWrapper({ propsData: { initOnAutofocus: true } });
- findLocalStorageSync().vm.$emit('input', EDITING_MODE_CONTENT_EDITOR);
+ buildWrapper({
+ propsData: { autofocus: true },
+ stubs: { ContentEditor: stubComponent(ContentEditor) },
+ });
});
it('sets the content editor autofocus property to end', () => {
@@ -247,19 +249,6 @@ describe('vue_shared/component/markdown/markdown_editor', () => {
it('updates localStorage value', () => {
expect(findLocalStorageSync().props().value).toBe(EDITING_MODE_MARKDOWN_FIELD);
});
-
- it('sets the textarea as the activeElement in the document', async () => {
- // The component should be rebuilt to attach it to the document body
- buildWrapper({ attachTo: document.body });
- await findSegmentedControl().vm.$emit('input', EDITING_MODE_CONTENT_EDITOR);
-
- expect(findContentEditor().exists()).toBe(true);
-
- await findSegmentedControl().vm.$emit('input', EDITING_MODE_MARKDOWN_FIELD);
- await findSegmentedControl().vm.$emit('change', EDITING_MODE_MARKDOWN_FIELD);
-
- expect(document.activeElement).toBe(findTextarea().element);
- });
});
describe('when content editor emits loading event', () => {