diff options
Diffstat (limited to 'library/cropperjs/test/specs/options/autoCrop.spec.js')
-rw-r--r-- | library/cropperjs/test/specs/options/autoCrop.spec.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/options/autoCrop.spec.js b/library/cropperjs/test/specs/options/autoCrop.spec.js new file mode 100644 index 000000000..19899e94d --- /dev/null +++ b/library/cropperjs/test/specs/options/autoCrop.spec.js @@ -0,0 +1,29 @@ +describe('autoCrop (option)', () => { + it('should crop automatically by default', (done) => { + const image = window.createImage(); + const cropper = new Cropper(image, { + ready() { + expect(cropper.cropped).to.be.true; + expect(window.getComputedStyle(cropper.cropBox).display).to.not.equal('none'); + done(); + }, + }); + + expect(cropper.options.autoCrop).to.be.true; + }); + + it('should not crop automatically', (done) => { + const image = window.createImage(); + const cropper = new Cropper(image, { + autoCrop: false, + + ready() { + expect(cropper.cropped).to.be.false; + expect(window.getComputedStyle(cropper.cropBox).display).to.equal('none'); + done(); + }, + }); + + expect(cropper.options.autoCrop).to.be.false; + }); +}); |