aboutsummaryrefslogblamecommitdiffstats
path: root/library/cropperjs/test/specs/options/aspectRatio.spec.js
blob: 4524d2810e5b3c4c1193f7a52cbcec56b9f39f58 (plain) (tree)























                                                               
describe('aspectRatio (option)', () => {
  it('should be `NaN` by default', () => {
    const image = window.createImage();
    const cropper = new Cropper(image);

    expect(cropper.options.aspectRatio).to.be.NaN;
  });

  it('should match the given aspect ratio', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      aspectRatio: 1,

      crop() {
        const cropBoxData = cropper.getCropBoxData();

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

    expect(cropper.options.aspectRatio).to.equal(1);
  });
});