diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-04 00:09:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-04 00:09:57 +0300 |
commit | b8fcc8edb4a289ef3ef4fee0ed8fd88e853a2396 (patch) | |
tree | 31658d7760d36aa3b368e020e08f4d21c678f2e3 /spec/frontend_integration/content_editor | |
parent | d83bbccfcd07ddab93be73959e3b149b75831e28 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend_integration/content_editor')
-rw-r--r-- | spec/frontend_integration/content_editor/content_editor_integration_spec.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/frontend_integration/content_editor/content_editor_integration_spec.js b/spec/frontend_integration/content_editor/content_editor_integration_spec.js index c0c6b5e5dc8..2fa491196ff 100644 --- a/spec/frontend_integration/content_editor/content_editor_integration_spec.js +++ b/spec/frontend_integration/content_editor/content_editor_integration_spec.js @@ -12,13 +12,16 @@ describe('content_editor', () => { let wrapper; let renderMarkdown; - const buildWrapper = ({ markdown = '' } = {}) => { + const buildWrapper = ({ markdown = '', listeners = {} } = {}) => { wrapper = mountExtended(ContentEditor, { propsData: { renderMarkdown, uploadsPath: '/', markdown, }, + listeners: { + ...listeners, + }, }); }; @@ -35,6 +38,10 @@ describe('content_editor', () => { renderMarkdown = jest.fn(); }); + afterEach(() => { + wrapper.destroy(); + }); + describe('when loading initial content', () => { describe('when the initial content is empty', () => { it('still hides the loading indicator', async () => { @@ -169,4 +176,16 @@ This reference tag is a mix of letters and numbers [^footnote]. }); }); }); + + it('bubbles up the keydown event captured by ProseMirror', async () => { + const keydownHandler = jest.fn(); + + buildWrapper({ listeners: { keydown: keydownHandler } }); + + await waitUntilContentIsLoaded(); + + wrapper.find('[contenteditable]').trigger('keydown', {}); + + expect(wrapper.emitted('keydown')).toHaveLength(1); + }); }); |