2019-07-31 22:56:46 +05:30
|
|
|
import { FIXTURES_PATH } from 'spec/test_constants';
|
2020-01-01 13:55:28 +05:30
|
|
|
import BalsamiqViewer from '~/blob/balsamiq/balsamiq_viewer';
|
2019-07-31 22:56:46 +05:30
|
|
|
|
|
|
|
const bmprPath = `${FIXTURES_PATH}/blob/balsamiq/test.bmpr`;
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
describe('Balsamiq integration spec', () => {
|
|
|
|
let container;
|
|
|
|
let endpoint;
|
|
|
|
let balsamiqViewer;
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
preloadFixtures('static/balsamiq_viewer.html');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
beforeEach(() => {
|
2019-07-07 11:18:12 +05:30
|
|
|
loadFixtures('static/balsamiq_viewer.html');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
container = document.getElementById('js-balsamiq-viewer');
|
|
|
|
balsamiqViewer = new BalsamiqViewer(container);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('successful response', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
beforeEach(done => {
|
2017-09-10 17:25:29 +05:30
|
|
|
endpoint = bmprPath;
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
balsamiqViewer
|
|
|
|
.loadFile(endpoint)
|
|
|
|
.then(done)
|
|
|
|
.catch(done.fail);
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
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', () => {
|
2018-12-13 13:39:08 +05:30
|
|
|
beforeEach(done => {
|
2017-09-10 17:25:29 +05:30
|
|
|
endpoint = 'invalid/path/to/file.bmpr';
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
balsamiqViewer
|
|
|
|
.loadFile(endpoint)
|
|
|
|
.then(done.fail, null)
|
|
|
|
.catch(done);
|
2017-09-10 17:25:29 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|