diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-12 18:06:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-12 18:06:26 +0300 |
commit | 69944ffb68788d190e81ff7e33db5dcb6c903184 (patch) | |
tree | 4112a1285f186c140749e8410a8a2788b6812500 /spec/javascripts/blob | |
parent | 1b7381e998ff4b33ec8f633766030082e95f10c8 (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 | 49 |
1 files changed, 14 insertions, 35 deletions
diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js index bbc59632f3c..06c06613887 100644 --- a/spec/javascripts/blob/viewer/index_spec.js +++ b/spec/javascripts/blob/viewer/index_spec.js @@ -11,13 +11,6 @@ describe('Blob viewer', () => { preloadFixtures('snippets/show.html'); - const asyncClick = () => - new Promise(resolve => { - document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); - - setTimeout(resolve); - }); - beforeEach(() => { mock = new MockAdapter(axios); @@ -73,12 +66,19 @@ describe('Blob viewer', () => { }); it('doesnt reload file if already loaded', done => { + const asyncClick = () => + new Promise(resolve => { + document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); + + setTimeout(resolve); + }); + asyncClick() .then(() => asyncClick()) .then(() => { - expect(document.querySelector('.blob-viewer[data-type="simple"]').dataset.loaded).toBe( - 'true', - ); + expect( + document.querySelector('.blob-viewer[data-type="simple"]').getAttribute('data-loaded'), + ).toBe('true'); done(); }) @@ -100,7 +100,9 @@ describe('Blob viewer', () => { }); it('has tooltip when disabled', () => { - expect(copyButton.dataset.title).toBe('Switch to the source to copy the file contents'); + expect(copyButton.getAttribute('data-original-title')).toBe( + 'Switch to the source to copy the file contents', + ); }); it('is blurred when clicked and disabled', () => { @@ -134,7 +136,7 @@ describe('Blob viewer', () => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setTimeout(() => { - expect(copyButton.dataset.title).toBe('Copy file contents'); + expect(copyButton.getAttribute('data-original-title')).toBe('Copy file contents'); done(); }); @@ -175,27 +177,4 @@ describe('Blob viewer', () => { expect(axios.get.calls.count()).toBe(1); }); }); - - describe('a URL inside the blob content', () => { - beforeEach(() => { - 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( - '<a href="https://golang.org/dl/">https://golang.org/dl/</a>', - ); - done(); - }) - .catch(() => { - fail(); - done(); - }); - }); - }); }); |