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:
Diffstat (limited to 'spec/javascripts/blob/viewer/index_spec.js')
-rw-r--r--spec/javascripts/blob/viewer/index_spec.js25
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();
+ });
+ });
});
});