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

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

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

      ready() {
        const canvasData = cropper.setCanvasData({
          height: 180,
        }).getCanvasData();

        expect(canvasData.height).to.equal(minCanvasHeight);
        done();
      },
    });

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