aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/aspectRatio.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/cropperjs/test/specs/options/aspectRatio.spec.js')
-rw-r--r--library/cropperjs/test/specs/options/aspectRatio.spec.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/options/aspectRatio.spec.js b/library/cropperjs/test/specs/options/aspectRatio.spec.js
new file mode 100644
index 000000000..4524d2810
--- /dev/null
+++ b/library/cropperjs/test/specs/options/aspectRatio.spec.js
@@ -0,0 +1,24 @@
+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);
+ });
+});