diff options
Diffstat (limited to 'spec/frontend_integration')
6 files changed, 66 insertions, 30 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 89b8d8d6d94..12cd6dcad83 100644 --- a/spec/frontend_integration/content_editor/content_editor_integration_spec.js +++ b/spec/frontend_integration/content_editor/content_editor_integration_spec.js @@ -61,29 +61,69 @@ describe('content_editor', () => { }); }); - it('renders footnote ids alongside the footnote definition', async () => { + describe('when preserveUnchangedMarkdown feature flag is enabled', () => { + beforeEach(() => { + gon.features = { preserveUnchangedMarkdown: true }; + }); + afterEach(() => { + gon.features = { preserveUnchangedMarkdown: false }; + }); + + it('processes and renders footnote ids alongside the footnote definition', async () => { + buildWrapper(); + + await contentEditorService.setSerializedContent(` +This reference tag is a mix of letters and numbers [^footnote]. + +[^footnote]: This is another footnote. + `); + await nextTick(); + + expect(wrapper.text()).toContain('footnote: This is another footnote'); + }); + + it('processes and displays reference definitions', async () => { + buildWrapper(); + + await contentEditorService.setSerializedContent(` +[GitLab][gitlab] + +[gitlab]: https://gitlab.com + `); + await nextTick(); + + expect(wrapper.find('pre').text()).toContain('[gitlab]: https://gitlab.com'); + }); + }); + + it('renders table of contents', async () => { + jest.useFakeTimers(); + buildWrapper(); renderMarkdown.mockResolvedValue(` - <p data-sourcepos="3:1-3:56" dir="auto"> - This reference tag is a mix of letters and numbers. <sup class="footnote-ref"><a href="#fn-footnote-2717" id="fnref-footnote-2717" data-footnote-ref="">2</a></sup> - </p> - <section class="footnotes" data-footnotes> - <ol> - <li id="fn-footnote-2717"> - <p data-sourcepos="6:7-6:31">This is another footnote. <a href="#fnref-footnote-2717" aria-label="Back to content" class="footnote-backref" data-footnote-backref=""><gl-emoji title="leftwards arrow with hook" data-name="leftwards_arrow_with_hook" data-unicode-version="1.1">↩</gl-emoji></a></p> - </li> - </ol> - </section> +<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(` - This reference tag is a mix of letters and numbers [^footnote]. +[TOC] - [^footnote]: This is another footnote. +# Heading 1 + +## Heading 2 `); + await nextTick(); + jest.runAllTimers(); - expect(wrapper.text()).toContain('footnote: This is another footnote'); + expect(wrapper.findByTestId('table-of-contents').text()).toContain('Heading 1'); + expect(wrapper.findByTestId('table-of-contents').text()).toContain('Heading 2'); }); }); diff --git a/spec/frontend_integration/fly_out_nav_browser_spec.js b/spec/frontend_integration/fly_out_nav_browser_spec.js index 47f3c6a0ac2..07ddc0220e6 100644 --- a/spec/frontend_integration/fly_out_nav_browser_spec.js +++ b/spec/frontend_integration/fly_out_nav_browser_spec.js @@ -308,19 +308,19 @@ describe('Fly out sidebar navigation', () => { describe('canShowSubItems', () => { it('returns true if on desktop size', () => { - expect(canShowSubItems()).toBeTruthy(); + expect(canShowSubItems()).toBe(true); }); it('returns false if on mobile size', () => { breakpointSize = 'xs'; - expect(canShowSubItems()).toBeFalsy(); + expect(canShowSubItems()).toBe(false); }); }); describe('canShowActiveSubItems', () => { it('returns true by default', () => { - expect(canShowActiveSubItems(el)).toBeTruthy(); + expect(canShowActiveSubItems(el)).toBe(true); }); it('returns false when active & expanded sidebar', () => { @@ -329,7 +329,7 @@ describe('Fly out sidebar navigation', () => { setSidebar(sidebar); - expect(canShowActiveSubItems(el)).toBeFalsy(); + expect(canShowActiveSubItems(el)).toBe(false); }); it('returns true when active & collapsed sidebar', () => { @@ -339,7 +339,7 @@ describe('Fly out sidebar navigation', () => { setSidebar(sidebar); - expect(canShowActiveSubItems(el)).toBeTruthy(); + expect(canShowActiveSubItems(el)).toBe(true); }); }); diff --git a/spec/frontend_integration/ide/helpers/start.js b/spec/frontend_integration/ide/helpers/start.js index 3c5ed9dfe20..925db12f36e 100644 --- a/spec/frontend_integration/ide/helpers/start.js +++ b/spec/frontend_integration/ide/helpers/start.js @@ -1,5 +1,4 @@ -/* global monaco */ - +import { editor as monacoEditor } from 'monaco-editor'; import setWindowLocation from 'helpers/set_window_location_helper'; import { TEST_HOST } from 'helpers/test_constants'; import { initIde } from '~/ide'; @@ -20,7 +19,7 @@ export default (container, { isRepoEmpty = false, path = '', mrId = '' } = {}) = const vm = initIde(el, { extendStore }); // We need to dispose of editor Singleton things or tests will bump into eachother - vm.$on('destroy', () => monaco.editor.getModels().forEach((model) => model.dispose())); + vm.$on('destroy', () => monacoEditor.getModels().forEach((model) => model.dispose())); return vm; }; diff --git a/spec/frontend_integration/ide/ide_integration_spec.js b/spec/frontend_integration/ide/ide_integration_spec.js index da48c600764..a6108fd71e1 100644 --- a/spec/frontend_integration/ide/ide_integration_spec.js +++ b/spec/frontend_integration/ide/ide_integration_spec.js @@ -1,6 +1,5 @@ import { nextTick } from 'vue'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; -import { setTestTimeout } from 'helpers/timeout'; import waitForPromises from 'helpers/wait_for_promises'; import { waitForText } from 'helpers/wait_for_text'; import { useOverclockTimers } from 'test_helpers/utils/overclock_timers'; @@ -17,9 +16,6 @@ describe('WebIDE', () => { beforeEach(() => { stubPerformanceWebAPI(); - // For some reason these tests were timing out in CI. - // We will investigate in https://gitlab.com/gitlab-org/gitlab/-/issues/298714 - setTestTimeout(20000); setHTMLFixture('<div class="webide-container"></div>'); container = document.querySelector('.webide-container'); }); diff --git a/spec/frontend_integration/snippets/snippets_notes_spec.js b/spec/frontend_integration/snippets/snippets_notes_spec.js index fdd3289bf58..5e9eaa1aada 100644 --- a/spec/frontend_integration/snippets/snippets_notes_spec.js +++ b/spec/frontend_integration/snippets/snippets_notes_spec.js @@ -50,6 +50,11 @@ describe('Integration Snippets notes', () => { 'circled latin capital letter m', ], ], + [':', ['100', '1234', '8ball', 'a', 'ab']], + // We do not want the search to start with space https://gitlab.com/gitlab-org/gitlab/-/issues/322548 + [': ', []], + // We want to preserve that we can have space INSIDE the search + [':red ci', ['large red circle']], ])('shows a correct list of matching emojis when user enters %s', async (input, expected) => { fillNoteTextarea(input); diff --git a/spec/frontend_integration/test_helpers/setup/setup_globals.js b/spec/frontend_integration/test_helpers/setup/setup_globals.js index ac5aeb1dd72..4f2eced40a5 100644 --- a/spec/frontend_integration/test_helpers/setup/setup_globals.js +++ b/spec/frontend_integration/test_helpers/setup/setup_globals.js @@ -1,7 +1,3 @@ -import { initializeTestTimeout } from 'helpers/timeout'; - -initializeTestTimeout(process.env.CI ? 20000 : 7000); - beforeEach(() => { window.gon = { api_version: 'v4', |