aboutsummaryrefslogblamecommitdiffstats
path: root/library/cropperjs/test/specs/options/minCanvasHeight.spec.js
blob: 028d22e9f39a2e6f172d77d3b586ce3038181cb6 (plain) (tree)


























                                                                      
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);
  });
});