username@email.com
2021-06-03 904fb460b9359fe92e00ce25804d96c8a52bb513
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
describe('zoomRatio (option)', () => {
  it('should be 0.1 by default', () => {
    const image = window.createImage();
    const viewer = new Viewer(image);
 
    expect(viewer.options.zoomRatio).to.equal(0.1);
  });
 
  it('should match the given zoom ratio', (done) => {
    const image = window.createImage();
    const zoomRatio = 0.2;
    const viewer = new Viewer(image, {
      zoomRatio,
 
      viewed() {
        const { imageData } = viewer;
        const { width } = imageData;
 
        viewer.viewer.dispatchEvent(window.createEvent('wheel', {
          deltaY: -1,
        }));
        expect(imageData.ratio).to.equal((width * (1 + zoomRatio)) / imageData.naturalWidth);
        viewer.hide(true);
        done();
      },
    });
 
    expect(viewer.options.zoomRatio).to.equal(zoomRatio);
    viewer.show();
  });
});