diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-05 18:12:12 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-05 18:12:12 +0300 |
commit | 8ec882085e734458ffe0fff8e2e4b72bc3871419 (patch) | |
tree | 6869bb67f3e66e9de828bc47a08577efa1e296c6 /spec/frontend_integration/content_editor | |
parent | f63850d9d6c3a81e78c93995c904ed6c0785ef19 (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 | 31 |
1 files changed, 31 insertions, 0 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 4d400a383e3..12cd6dcad83 100644 --- a/spec/frontend_integration/content_editor/content_editor_integration_spec.js +++ b/spec/frontend_integration/content_editor/content_editor_integration_spec.js @@ -95,4 +95,35 @@ This reference tag is a mix of letters and numbers [^footnote]. expect(wrapper.find('pre').text()).toContain('[gitlab]: https://gitlab.com'); }); }); + + it('renders table of contents', async () => { + jest.useFakeTimers(); + + buildWrapper(); + + renderMarkdown.mockResolvedValue(` +<ul class="section-nav"> +</ul> +<h1 dir="auto" data-sourcepos="3:1-3:11"> + Heading 1 +</h1> +<h2 dir="auto" data-sourcepos="5:1-5:12"> + Heading 2 +</h2> + `); + + await contentEditorService.setSerializedContent(` +[TOC] + +# Heading 1 + +## Heading 2 + `); + + await nextTick(); + jest.runAllTimers(); + + expect(wrapper.findByTestId('table-of-contents').text()).toContain('Heading 1'); + expect(wrapper.findByTestId('table-of-contents').text()).toContain('Heading 2'); + }); }); |