aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/minCropBoxWidth.spec.js
blob: 5a2f44faa0f6fff884da6aa41fa4fc5c723116d4 (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
describe('minCropBoxWidth (option)', () => {
  it('should be `0` by default', () => {
    const image = window.createImage();
    const cropper = new Cropper(image);

    expect(cropper.options.minCropBoxWidth).to.equal(0);
  });

  it('should match the given minimum size', (done) => {
    const image = window.createImage();
    const minCropBoxWidth = 300;
    const cropper = new Cropper(image, {
      minCropBoxWidth,

      ready() {
        const cropBoxData = cropper.setCropBoxData({
          width: 200,
        }).getCropBoxData();

        expect(cropBoxData.width).to.equal(minCropBoxWidth);
        done();
      },
    });

    expect(cropper.options.minCropBoxWidth).to.equal(minCropBoxWidth);
  });
});