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

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

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

      ready() {
        const cropBoxData = cropper.setCropBoxData({
          height: 100,
        }).getCropBoxData();

        expect(cropBoxData.height).to.equal(minCropBoxHeight);
        done();
      },
    });

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