viewerjs/test/specs/options/className.spec.js
2018-10-25 20:05:33 +08:00

39 lines
995 B
JavaScript

describe('className (option)', () => {
it('should be empty string by default', () => {
const image = window.createImage();
const viewer = new Viewer(image);
expect(viewer.options.className).to.equal('');
});
it('should add the given class name to the viewer', (done) => {
const image = window.createImage();
const className = 'custom-viewer';
const viewer = new Viewer(image, {
className,
ready(event) {
expect(viewer.viewer.className).to.include(className);
event.preventDefault();
done();
},
});
viewer.show();
});
it('should support multiple class names', (done) => {
const image = window.createImage();
const className = 'custom-viewer another-custom-viewer';
const viewer = new Viewer(image, {
className,
ready(event) {
expect(viewer.viewer.className).to.include(className);
event.preventDefault();
done();
},
});
viewer.show();
});
});