aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/methods/setDragMode.spec.js
blob: 612220ec26bd05c553fa77ed544189527828f085 (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('setDragMode (method)', () => {
  it('should set the drag mode to "move"', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const { dragBox } = cropper;

        expect(dragBox.dataset.cropperAction).to.equal('crop');
        cropper.setDragMode('move');
        expect(dragBox.dataset.cropperAction).to.equal('move');
        done();
      },
    });
  });

  it('should set the drag mode to "none"', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const { dragBox } = cropper;

        expect(dragBox.dataset.cropperAction).to.equal('crop');
        cropper.setDragMode('none');
        expect(dragBox.dataset.cropperAction).to.equal('none');
        done();
      },
    });
  });
});