aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/cropBoxMovable.spec.js
blob: 8a1e52cc4164dc06a62063591c02727517648e30 (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
30
31
describe('cropBoxMovable (option)', () => {
  it('should by movable by default', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const face = cropper.cropper.querySelector('.cropper-face');

        expect(face.dataset.cropperAction).to.equal('all');
        done();
      },
    });

    expect(cropper.options.cropBoxMovable).to.be.true;
  });

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

      ready() {
        const face = cropper.cropper.querySelector('.cropper-face');

        expect(face.dataset.cropperAction).to.not.equal('all');
        done();
      },
    });

    expect(cropper.options.cropBoxMovable).to.be.false;
  });
});