Fixed failing JS tests

This commit is contained in:
Phil Hughes 2017-04-26 10:09:07 +01:00 committed by Douwe Maan
parent dc4726f0a7
commit 95658fb62a
2 changed files with 8 additions and 4 deletions

View file

@ -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();

View file

@ -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();
});