summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-04-26 10:09:07 +0100
committerDouwe Maan <douwe@selenight.nl>2017-04-27 12:23:27 -0500
commit95658fb62a955a40260d5b7c4ccd51ce72ae1fb9 (patch)
tree6f8f5be3b4f9d1a070b31a8fc29e5404300ff5dd
parentdc4726f0a707019c64e60e58d45bb647a43d4ec8 (diff)
downloadgitlab-ce-95658fb62a955a40260d5b7c4ccd51ce72ae1fb9.tar.gz
Fixed failing JS tests
-rw-r--r--app/assets/javascripts/blob/viewer/index.js2
-rw-r--r--spec/javascripts/blob/viewer/index_spec.js10
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(() => {
@@ -74,6 +74,10 @@ describe('Blob viewer', () => {
).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();
});