diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-26 00:45:03 +0000 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-26 00:45:03 +0000 |
commit | 0efbc126d080892214d312a3ae2549f1fc341cb6 (patch) | |
tree | b7131288bcbc3c5b0160ad55ed4b95523ce71c12 /spec/javascripts/blob/viewer/index_spec.js | |
parent | 46e3ad4b948dedf67245708493ee17c4429f8bf3 (diff) | |
parent | 679c0048a8f679aad456c02e30486150bbd0d93d (diff) | |
download | gitlab-ce-0efbc126d080892214d312a3ae2549f1fc341cb6.tar.gz |
Merge branch 'master' into 'prettify-all-the-things-4'prettify-all-the-things-4
# Conflicts:
# app/assets/javascripts/sidebar/components/time_tracking/collapsed_state.vue
Diffstat (limited to 'spec/javascripts/blob/viewer/index_spec.js')
-rw-r--r-- | spec/javascripts/blob/viewer/index_spec.js | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js index 8b79624d9f4..93a942fe8d4 100644 --- a/spec/javascripts/blob/viewer/index_spec.js +++ b/spec/javascripts/blob/viewer/index_spec.js @@ -35,12 +35,13 @@ describe('Blob viewer', () => { window.location.hash = ''; }); - it('loads source file after switching views', (done) => { + it('loads source file after switching views', done => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setTimeout(() => { expect( - document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]') + document + .querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]') .classList.contains('hidden'), ).toBeFalsy(); @@ -48,14 +49,15 @@ describe('Blob viewer', () => { }); }); - it('loads source file when line number is in hash', (done) => { + it('loads source file when line number is in hash', done => { window.location.hash = '#L1'; new BlobViewer(); setTimeout(() => { expect( - document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]') + document + .querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]') .classList.contains('hidden'), ).toBeFalsy(); @@ -63,12 +65,13 @@ 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(); + 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); - }); + setTimeout(resolve); + }); asyncClick() .then(() => asyncClick()) @@ -93,15 +96,13 @@ describe('Blob viewer', () => { }); it('disabled on load', () => { - expect( - copyButton.classList.contains('disabled'), - ).toBeTruthy(); + expect(copyButton.classList.contains('disabled')).toBeTruthy(); }); it('has tooltip when disabled', () => { - expect( - copyButton.getAttribute('data-original-title'), - ).toBe('Switch to the source to copy it to the clipboard'); + expect(copyButton.getAttribute('data-original-title')).toBe( + 'Switch to the source to copy it to the clipboard', + ); }); it('is blurred when clicked and disabled', () => { @@ -121,25 +122,21 @@ describe('Blob viewer', () => { expect(copyButton.blur).not.toHaveBeenCalled(); }); - it('enables after switching to simple view', (done) => { + it('enables after switching to simple view', done => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setTimeout(() => { - expect( - copyButton.classList.contains('disabled'), - ).toBeFalsy(); + expect(copyButton.classList.contains('disabled')).toBeFalsy(); done(); }); }); - it('updates tooltip after switching to simple view', (done) => { + it('updates tooltip after switching to simple view', done => { document.querySelector('.js-blob-viewer-switch-btn[data-viewer="simple"]').click(); setTimeout(() => { - expect( - copyButton.getAttribute('data-original-title'), - ).toBe('Copy source to clipboard'); + expect(copyButton.getAttribute('data-original-title')).toBe('Copy source to clipboard'); done(); }); @@ -162,9 +159,8 @@ describe('Blob viewer', () => { blob.switchToViewer('simple'); - expect( - simpleBtn.classList.contains('active'), - ).toBeTruthy(); + expect(simpleBtn.classList.contains('active')).toBeTruthy(); + expect(simpleBtn.blur).toHaveBeenCalled(); }); |