summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 13:51:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-05-26 13:51:51 +0000
commit900b14e4e77af2ca4589088d8cebc00fd6ebc1e1 (patch)
tree4af08feb71ab459b72a553675ca7e6b998fdfd76 /spec
parent00ed89bc218dc88eae9a4e8de1ce5813729ebfdc (diff)
downloadgitlab-ce-900b14e4e77af2ca4589088d8cebc00fd6ebc1e1.tar.gz
Add latest changes from gitlab-org/security/gitlab@13-0-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/frontend/fixtures/static/issue_with_mermaid_graph.html82
-rw-r--r--spec/frontend/issue_spec.js27
2 files changed, 109 insertions, 0 deletions
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 @@
+<div class="description" updated-at="">
+ <div class="md issue-realtime-trigger-pulse">
+ <svg
+ id="mermaid-1587752414912"
+ width="100%"
+ xmlns="http://www.w3.org/2000/svg"
+ style="max-width: 185.35000610351562px;"
+ viewBox="0 0 185.35000610351562 50.5"
+ class="mermaid"
+ >
+ <g transform="translate(0, 0)">
+ <g class="output">
+ <g class="clusters"></g>
+ <g class="edgePaths"></g>
+ <g class="edgeLabels"></g>
+ <g class="nodes">
+ <g
+ class="node js-issuable-actions btn-close clickable"
+ style="opacity: 1;"
+ id="A"
+ transform="translate(92.67500305175781,25.25)"
+ title="click to PUT"
+ >
+ <a
+ class="js-issuable-actions btn-close clickable"
+ href="https://invalid"
+ rel="noopener"
+ >
+ <rect
+ rx="0"
+ ry="0"
+ x="-84.67500305175781"
+ y="-17.25"
+ width="169.35000610351562"
+ height="34.5"
+ class="label-container"
+ ></rect>
+ <g class="label" transform="translate(0,0)">
+ <g transform="translate(-74.67500305175781,-7.25)">
+ <text style="">
+ <tspan xml:space="preserve" dy="1em" x="1">Click to send a PUT request</tspan>
+ </text>
+ </g>
+ </g>
+ </a>
+ </g>
+ </g>
+ </g>
+ </g>
+ <text class="source" display="none">
+ Click to send a PUT request
+ </text>
+ </svg>
+ </div>
+ <textarea
+ data-update-url="/h5bp/html5-boilerplate/-/issues/35.json"
+ dir="auto"
+ class="hidden js-task-list-field"
+ ></textarea>
+ <div class="modal-open recaptcha-modal js-recaptcha-modal" style="display: none;">
+ <div role="dialog" tabindex="-1" class="modal d-block">
+ <div role="document" class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h4 class="modal-title float-left">Please solve the reCAPTCHA</h4>
+ <button type="button" data-dismiss="modal" aria-label="Close" class="close float-right">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <div>
+ <p>We want to be sure it is you, please confirm you are not a robot.</p>
+ <div></div>
+ </div>
+ </div>
+ <!---->
+ </div>
+ </div>
+ </div>
+ <div class="modal-backdrop fade show"></div>
+ </div>
+</div>
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();
+ });
+ });
+ });
});