summaryrefslogtreecommitdiff
path: root/spec/javascripts/blob/viewer
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-10-17 02:13:26 -0500
committerMike Greiling <mike@pixelcog.com>2018-10-17 11:18:17 -0500
commitf666026d71ebefd70219d5078b1f0c83fa01f84d (patch)
treece43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/blob/viewer
parent5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff)
downloadgitlab-ce-f666026d71ebefd70219d5078b1f0c83fa01f84d.tar.gz
Prettify all spec files
Diffstat (limited to 'spec/javascripts/blob/viewer')
-rw-r--r--spec/javascripts/blob/viewer/index_spec.js47
1 files changed, 21 insertions, 26 deletions
diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js
index b5a9db2da3a..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,7 @@ describe('Blob viewer', () => {
blob.switchToViewer('simple');
- expect(
- simpleBtn.classList.contains('active'),
- ).toBeTruthy();
+ expect(simpleBtn.classList.contains('active')).toBeTruthy();
expect(simpleBtn.blur).toHaveBeenCalled();
});