viewerjs/test/specs/options/ready.spec.js
2018-03-10 14:56:12 +08:00

35 lines
779 B
JavaScript

describe('ready (option)', () => {
it('should be null be default', () => {
const image = window.createImage();
const viewer = new Viewer(image);
expect(viewer.options.ready).to.be.null;
});
it('should execute the `ready` hook function', (done) => {
const image = window.createImage();
const viewer = new Viewer(image, {
ready(event) {
expect(event.type).to.equal('ready');
event.preventDefault();
done();
},
});
viewer.show();
});
it('should execute the `ready` hook function in inline mode', (done) => {
const image = window.createImage();
new Viewer(image, {
inline: true,
ready(event) {
expect(event.type).to.equal('ready');
done();
},
});
});
});