aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/autoCrop.spec.js
blob: 19899e94d13ce853a878fe3d4e88a5df965677a4 (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('autoCrop (option)', () => {
  it('should crop automatically by default', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        expect(cropper.cropped).to.be.true;
        expect(window.getComputedStyle(cropper.cropBox).display).to.not.equal('none');
        done();
      },
    });

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

  it('should not crop automatically', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      autoCrop: false,

      ready() {
        expect(cropper.cropped).to.be.false;
        expect(window.getComputedStyle(cropper.cropBox).display).to.equal('none');
        done();
      },
    });

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