Commit 95658fb6 authored by Phil Hughes's avatar Phil Hughes Committed by Douwe Maan

Fixed failing JS tests

parent dc4726f0
/* 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();
......
/* 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();
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment