diff options
Diffstat (limited to 'library/cropperjs/test/specs/options/scalable.spec.js')
-rw-r--r-- | library/cropperjs/test/specs/options/scalable.spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/options/scalable.spec.js b/library/cropperjs/test/specs/options/scalable.spec.js new file mode 100644 index 000000000..3b6f1df4f --- /dev/null +++ b/library/cropperjs/test/specs/options/scalable.spec.js @@ -0,0 +1,33 @@ +describe('scalable (option)', () => { + it('should be scalable by default', (done) => { + const image = window.createImage(); + const cropper = new Cropper(image, { + ready() { + const imageData = cropper.scale(-1, -1).getImageData(); + + expect(imageData.scaleX).to.equal(-1); + expect(imageData.scaleY).to.equal(-1); + done(); + }, + }); + + expect(cropper.options.scalable).to.be.true; + }); + + it('should not be scalable', (done) => { + const image = window.createImage(); + const cropper = new Cropper(image, { + scalable: false, + + ready() { + const imageData = cropper.scale(-1, -1).getImageData(); + + expect(imageData.scaleX).to.be.undefined; + expect(imageData.scaleY).to.be.undefined; + done(); + }, + }); + + expect(cropper.options.scalable).to.be.false; + }); +}); |