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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-26 09:09:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-26 09:09:56 +0300
commitf88f72df028c02be399ecf3d32c7cf0d8404784f (patch)
tree1a9a607f7a7915302a6f6ec296760279a2d0bb09 /spec/frontend/behaviors
parentc2d7378a6896085f1f2d27c95455fc9728881e60 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/behaviors')
-rw-r--r--spec/frontend/behaviors/markdown/render_sandboxed_mermaid_spec.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/frontend/behaviors/markdown/render_sandboxed_mermaid_spec.js b/spec/frontend/behaviors/markdown/render_sandboxed_mermaid_spec.js
new file mode 100644
index 00000000000..b4844ebc765
--- /dev/null
+++ b/spec/frontend/behaviors/markdown/render_sandboxed_mermaid_spec.js
@@ -0,0 +1,31 @@
+import $ from 'jquery';
+import renderMermaid from '~/behaviors/markdown/render_sandboxed_mermaid';
+
+describe('Render mermaid diagrams for Gitlab Flavoured Markdown', () => {
+ it('Does something', () => {
+ document.body.dataset.page = '';
+ setFixtures(`
+ <div class="gl-relative markdown-code-block js-markdown-code">
+ <pre data-sourcepos="1:1-7:3" class="code highlight js-syntax-highlight language-mermaid white" lang="mermaid" id="code-4">
+ <code class="js-render-mermaid">
+ <span id="LC1" class="line" lang="mermaid">graph TD;</span>
+ <span id="LC2" class="line" lang="mermaid">A--&gt;B</span>
+ <span id="LC3" class="line" lang="mermaid">A--&gt;C</span>
+ <span id="LC4" class="line" lang="mermaid">B--&gt;D</span>
+ <span id="LC5" class="line" lang="mermaid">C--&gt;D</span>
+ </code>
+ </pre>
+ <copy-code>
+ <button type="button" class="btn btn-default btn-md gl-button btn-icon has-tooltip" data-title="Copy to clipboard" data-clipboard-target="pre#code-4">
+ <svg><use xlink:href="/assets/icons-7f1680a3670112fe4c8ef57b9dfb93f0f61b43a2a479d7abd6c83bcb724b9201.svg#copy-to-clipboard"></use></svg>
+ </button>
+ </copy-code>
+ </div>`);
+ const els = $('pre.js-syntax-highlight').find('.js-render-mermaid');
+
+ renderMermaid(els);
+
+ jest.runAllTimers();
+ expect(document.querySelector('pre.js-syntax-highlight').classList).toContain('gl-sr-only');
+ });
+});