aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/zoomable.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/cropperjs/test/specs/options/zoomable.spec.js')
-rw-r--r--library/cropperjs/test/specs/options/zoomable.spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/options/zoomable.spec.js b/library/cropperjs/test/specs/options/zoomable.spec.js
new file mode 100644
index 000000000..d0fbec5ec
--- /dev/null
+++ b/library/cropperjs/test/specs/options/zoomable.spec.js
@@ -0,0 +1,35 @@
+describe('zoomable (option)', () => {
+ it('should be zoomable by default', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+ ready() {
+ const canvasData = cropper.getCanvasData();
+ const changedCanvasData = cropper.zoom(0.1).getCanvasData();
+
+ expect(changedCanvasData.width).to.be.above(canvasData.width);
+ expect(changedCanvasData.height).to.be.above(canvasData.height);
+ done();
+ },
+ });
+
+ expect(cropper.options.zoomable).to.be.true;
+ });
+
+ it('should not be zoomable', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+ zoomable: false,
+
+ ready() {
+ const canvasData = cropper.getCanvasData();
+ const changedCanvasData = cropper.zoom(0.1).getCanvasData();
+
+ expect(changedCanvasData.width).to.equal(canvasData.width);
+ expect(changedCanvasData.height).to.equal(canvasData.height);
+ done();
+ },
+ });
+
+ expect(cropper.options.zoomable).to.be.false;
+ });
+});