From 900b14e4e77af2ca4589088d8cebc00fd6ebc1e1 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 26 May 2020 13:51:51 +0000 Subject: Add latest changes from gitlab-org/security/gitlab@13-0-stable-ee --- .../fixtures/static/issue_with_mermaid_graph.html | 82 ++++++++++++++++++++++ spec/frontend/issue_spec.js | 27 +++++++ 2 files changed, 109 insertions(+) create mode 100644 spec/frontend/fixtures/static/issue_with_mermaid_graph.html (limited to 'spec') diff --git a/spec/frontend/fixtures/static/issue_with_mermaid_graph.html b/spec/frontend/fixtures/static/issue_with_mermaid_graph.html new file mode 100644 index 00000000000..4b60842a655 --- /dev/null +++ b/spec/frontend/fixtures/static/issue_with_mermaid_graph.html @@ -0,0 +1,82 @@ +
+
+ + + + + + + + + + + + + + Click to send a PUT request + + + + + + + + + + Click to send a PUT request + + +
+ + +
diff --git a/spec/frontend/issue_spec.js b/spec/frontend/issue_spec.js index 586bd7f8529..24020daf728 100644 --- a/spec/frontend/issue_spec.js +++ b/spec/frontend/issue_spec.js @@ -18,6 +18,7 @@ describe('Issue', () => { preloadFixtures('issues/closed-issue.html'); preloadFixtures('issues/issue-with-task-list.html'); preloadFixtures('issues/open-issue.html'); + preloadFixtures('static/issue_with_mermaid_graph.html'); function expectErrorMessage() { const $flashMessage = $('div.flash-alert'); @@ -228,4 +229,30 @@ describe('Issue', () => { }); }); }); + + describe('when not displaying blocked warning', () => { + describe('when clicking a mermaid graph inside an issue description', () => { + let mock; + let spy; + + beforeEach(() => { + loadFixtures('static/issue_with_mermaid_graph.html'); + mock = new MockAdapter(axios); + spy = jest.spyOn(axios, 'put'); + }); + + afterEach(() => { + mock.restore(); + jest.clearAllMocks(); + }); + + it('does not make a PUT request', () => { + Issue.prototype.initIssueBtnEventListeners(); + + $('svg a.js-issuable-actions').trigger('click'); + + expect(spy).not.toHaveBeenCalled(); + }); + }); + }); }); -- cgit v1.2.1