diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-08 15:06:32 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-08 15:06:32 +0300 |
commit | 61f0c58946ebac453b55a657cd4be1ac50a01e11 (patch) | |
tree | 7b164c1cc9dc8ab1d100ca4fe90decf6d72e984b /spec/javascripts/blob | |
parent | d23b2a0871f3ca507aafa949e0314625f1f0c6a7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/blob')
-rw-r--r-- | spec/javascripts/blob/viewer/index_spec.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js index bbc59632f3c..766c3378584 100644 --- a/spec/javascripts/blob/viewer/index_spec.js +++ b/spec/javascripts/blob/viewer/index_spec.js @@ -176,15 +176,13 @@ describe('Blob viewer', () => { }); }); - describe('a URL inside the blob content', () => { - beforeEach(() => { + describe('linkifyURLs', () => { + it('renders a plain url as a link in simple view', done => { mock.onGet('http://test.host/snippets/1.json?viewer=simple').reply(200, { html: '<div class="js-blob-content"><pre class="code"><code><span class="line" lang="yaml"><span class="c1">To install gitlab-shell you also need a Go compiler version 1.8 or newer. https://golang.org/dl/</span></span></code></pre></div>', }); - }); - it('is rendered as a link in simple view', done => { asyncClick() .then(() => { expect(document.querySelector('.blob-viewer[data-type="simple"]').innerHTML).toContain( @@ -197,5 +195,24 @@ describe('Blob viewer', () => { done(); }); }); + + it('leaves an unescaped url untouched', done => { + mock.onGet('http://test.host/snippets/1.json?viewer=simple').reply(200, { + html: + '<div class="js-blob-content"><pre class="code"><code><span class="line" lang="yaml"><a href="https://golang.org/dl/">golang</a></span></span></code></pre></div>', + }); + + asyncClick() + .then(() => { + expect(document.querySelector('.blob-viewer[data-type="simple"]').innerHTML).toContain( + '<a href="https://golang.org/dl/">golang</a>', + ); + done(); + }) + .catch(() => { + fail(); + done(); + }); + }); }); }); |