From 95658fb62a955a40260d5b7c4ccd51ce72ae1fb9 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 26 Apr 2017 10:09:07 +0100 Subject: [PATCH] Fixed failing JS tests --- app/assets/javascripts/blob/viewer/index.js | 2 +- spec/javascripts/blob/viewer/index_spec.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index 8a5fb187a71..7efa8537298 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -1,4 +1,3 @@ -/* eslint-disable no-new */ /* global Flash */ export default class BlobViewer { constructor() { @@ -76,6 +75,7 @@ export default class BlobViewer { url, dataType: 'JSON', }) + .fail(() => new Flash('Error loading source view')) .done((data) => { viewer.innerHTML = data.html; $(viewer).syntaxHighlight(); diff --git a/spec/javascripts/blob/viewer/index_spec.js b/spec/javascripts/blob/viewer/index_spec.js index fe45ee3c083..2031898cf54 100644 --- a/spec/javascripts/blob/viewer/index_spec.js +++ b/spec/javascripts/blob/viewer/index_spec.js @@ -1,7 +1,7 @@ /* eslint-disable no-new */ import BlobViewer from '~/blob/viewer/index'; -describe('Blob viewer', () => { +fdescribe('Blob viewer', () => { preloadFixtures('blob/show.html.raw'); beforeEach(() => { @@ -73,6 +73,10 @@ describe('Blob viewer', () => { document.querySelector('.blob-viewer[data-type="simple"]').getAttribute('data-loaded'), ).toBe('true'); + done(); + }) + .catch(() => { + fail(); done(); }); }); @@ -87,7 +91,7 @@ describe('Blob viewer', () => { it('has tooltip when disabled', () => { expect( document.querySelector('.js-copy-blob-source-btn').getAttribute('data-original-title'), - ).toBe('Switch to the source view to copy the source to the clipboard'); + ).toBe('Switch to the source to copy it to the clipboard'); }); it('enables after switching to simple view', (done) => { @@ -111,7 +115,7 @@ describe('Blob viewer', () => { expect( document.querySelector('.js-copy-blob-source-btn').getAttribute('data-original-title'), - ).toBe('Copy to clipboard'); + ).toBe('Copy source to clipboard'); done(); });