gitlab-org--gitlab-foss/spec/javascripts/blob/balsamiq/balsamiq_viewer_integration_spec.js
Winnie Hellmann ad985a7a28 Merge branch 'winh-remove-sushi' into 'master'
Remove .raw from JavaScript fixture file names

Closes #59201

See merge request gitlab-org/gitlab-ce!26430

(cherry picked from commit 79a45f7f02)
2019-03-26 16:03:28 +00:00

55 lines
1.4 KiB
JavaScript

import BalsamiqViewer from '~/blob/balsamiq/balsamiq_viewer';
import bmprPath from '../../fixtures/blob/balsamiq/test.bmpr';
describe('Balsamiq integration spec', () => {
let container;
let endpoint;
let balsamiqViewer;
preloadFixtures('static/balsamiq_viewer.html');
beforeEach(() => {
loadFixtures('static/balsamiq_viewer.html');
container = document.getElementById('js-balsamiq-viewer');
balsamiqViewer = new BalsamiqViewer(container);
});
describe('successful response', () => {
beforeEach(done => {
endpoint = bmprPath;
balsamiqViewer
.loadFile(endpoint)
.then(done)
.catch(done.fail);
});
it('does not show loading icon', () => {
expect(document.querySelector('.loading')).toBeNull();
});
it('renders the balsamiq previews', () => {
expect(document.querySelectorAll('.previews .preview').length).not.toEqual(0);
});
});
describe('error getting file', () => {
beforeEach(done => {
endpoint = 'invalid/path/to/file.bmpr';
balsamiqViewer
.loadFile(endpoint)
.then(done.fail, null)
.catch(done);
});
it('does not show loading icon', () => {
expect(document.querySelector('.loading')).toBeNull();
});
it('does not render the balsamiq previews', () => {
expect(document.querySelectorAll('.previews .preview').length).toEqual(0);
});
});
});