aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/methods/moveTo.spec.js
blob: 42403b41cdca9716c5d1f5486ee44612e9c9b01b (plain) (blame)
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
describe('moveTo (method)', () => {
  it('should move to the given coordinate', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const canvasData = cropper.moveTo(100, 100).getCanvasData();

        expect(canvasData.left).to.equal(100);
        expect(canvasData.top).to.equal(100);
        done();
      },
    });
  });

  it('should not work when it is not movable', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      movable: false,

      ready() {
        const canvasData = cropper.moveTo(100, 100).getCanvasData();

        expect(canvasData.left).to.not.equal(100);
        expect(canvasData.top).to.not.equal(100);
        done();
      },
    });
  });
});