diff options
Diffstat (limited to 'library/cropperjs/test/options')
32 files changed, 0 insertions, 1283 deletions
diff --git a/library/cropperjs/test/options/aspectRatio.js b/library/cropperjs/test/options/aspectRatio.js deleted file mode 100644 index d7ba89401..000000000 --- a/library/cropperjs/test/options/aspectRatio.js +++ /dev/null @@ -1,39 +0,0 @@ -QUnit.test('options#aspectRatio: NaN', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // aspectRatio: NaN, - - ready: function () { - var cropper = this.cropper; - - assert.ok(isNaN(cropper.options.aspectRatio)); - - done(); - } - }); -}); - -QUnit.test('options#aspectRatio: 1', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - aspectRatio: 1, - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.options.aspectRatio, 1); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/autoCrop.js b/library/cropperjs/test/options/autoCrop.js deleted file mode 100644 index f010966eb..000000000 --- a/library/cropperjs/test/options/autoCrop.js +++ /dev/null @@ -1,39 +0,0 @@ -QUnit.test('options#autoCrop: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // autoCrop: true, - - ready: function () { - var cropper = this.cropper; - - assert.ok(cropper.cropped); - - done(); - } - }); -}); - -QUnit.test('options#autoCrop: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - autoCrop: false, - - ready: function () { - var cropper = this.cropper; - - assert.notOk(cropper.cropped); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/background.js b/library/cropperjs/test/options/background.js deleted file mode 100644 index 21dbb8b12..000000000 --- a/library/cropperjs/test/options/background.js +++ /dev/null @@ -1,40 +0,0 @@ -QUnit.test('options#background: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // background: true, - - ready: function () { - var cropper = this.cropper; - - assert.ok(util.hasClass(cropper.cropper, 'cropper-bg')); - - done(); - } - }); -}); - -QUnit.test('options#background: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - background: false, - - ready: function () { - var cropper = this.cropper; - - assert.notOk(util.hasClass(cropper.cropper, 'cropper-bg')); - - done(); - } - }); - -}); diff --git a/library/cropperjs/test/options/center.js b/library/cropperjs/test/options/center.js deleted file mode 100644 index 5d45eb021..000000000 --- a/library/cropperjs/test/options/center.js +++ /dev/null @@ -1,41 +0,0 @@ -QUnit.test('options#center: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // center: true, - - ready: function () { - var cropper = this.cropper; - var center = util.getByClass(cropper.cropBox, 'cropper-center'); - - assert.notOk(util.hasClass(center[0], 'cropper-hidden')); - - done(); - } - }); -}); - -QUnit.test('options#center: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - center: false, - - ready: function () { - var cropper = this.cropper; - var center = util.getByClass(cropper.cropBox, 'cropper-center'); - - assert.ok(util.hasClass(center[0], 'cropper-hidden')); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/checkCrossOrigin.js b/library/cropperjs/test/options/checkCrossOrigin.js deleted file mode 100644 index 86fde8f6f..000000000 --- a/library/cropperjs/test/options/checkCrossOrigin.js +++ /dev/null @@ -1,67 +0,0 @@ -QUnit.test('options#checkCrossOrigin: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage({ - src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg' - }); - - assert.expect(2); - - return new Cropper(image, { - // checkCrossOrigin: true, - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.image.crossOrigin, 'anonymous'); - assert.ok(cropper.image.src.indexOf('timestamp') >= 0); - - done(); - } - }); -}); - -QUnit.test('options#checkCrossOrigin: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage({ - src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg' - }); - - assert.expect(2); - - return new Cropper(image, { - checkCrossOrigin: false, - - ready: function () { - var cropper = this.cropper; - - assert.notStrictEqual(cropper.image.crossOrigin, 'anonymous'); - assert.ok(cropper.image.src.indexOf('timestamp') < 0); - - done(); - } - }); -}); - -QUnit.test('options#checkCrossOrigin: exists crossOrigin attribute', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage({ - src: 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg', - crossOrigin: 'anonymous' - }); - - assert.expect(2); - - return new Cropper(image, { - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.image.crossOrigin, 'anonymous'); - assert.ok(cropper.image.src.indexOf('timestamp') < 0); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/checkOrientation.js b/library/cropperjs/test/options/checkOrientation.js deleted file mode 100644 index 0fe548404..000000000 --- a/library/cropperjs/test/options/checkOrientation.js +++ /dev/null @@ -1,43 +0,0 @@ -QUnit.test('options#checkOrientation: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage({ - src: '../docs/images/picture-3.jpg' - }); - - assert.expect(1); - - return new Cropper(image, { - // checkOrientation: true, - - ready: function () { - var cropper = this.cropper; - - assert.notStrictEqual(cropper.getData().rotate, 0); - - done(); - } - }); -}); - -QUnit.test('options#checkOrientation: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage({ - src: '../docs/images/picture-3.jpg' - }); - - assert.expect(1); - - return new Cropper(image, { - checkOrientation: false, - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.getData().rotate, 0); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/crop.js b/library/cropperjs/test/options/crop.js deleted file mode 100644 index a4b48585e..000000000 --- a/library/cropperjs/test/options/crop.js +++ /dev/null @@ -1,21 +0,0 @@ -QUnit.test('options#crop', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(7); - - return new Cropper(image, { - crop: function (e) { - assert.ok(util.isNumber(e.detail.x)); - assert.ok(util.isNumber(e.detail.y)); - assert.ok(util.isNumber(e.detail.width)); - assert.ok(util.isNumber(e.detail.height)); - assert.ok(util.isNumber(e.detail.rotate)); - assert.ok(util.isNumber(e.detail.scaleX)); - assert.ok(util.isNumber(e.detail.scaleY)); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/cropBoxMovable.js b/library/cropperjs/test/options/cropBoxMovable.js deleted file mode 100644 index d5d3e1d7d..000000000 --- a/library/cropperjs/test/options/cropBoxMovable.js +++ /dev/null @@ -1,41 +0,0 @@ -QUnit.test('options#cropBoxMovable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // cropBoxMovable: true, - - ready: function () { - var cropper = this.cropper; - var face = util.getByClass(cropper.cropBox, 'cropper-face'); - - assert.strictEqual(face[0].dataset.action, 'all'); - - done(); - } - }); -}); - -QUnit.test('options#cropBoxMovable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - cropBoxMovable: false, - - ready: function () { - var cropper = this.cropper; - var face = util.getByClass(cropper.cropBox, 'cropper-face'); - - assert.strictEqual(face[0].dataset.action, cropper.options.dragMode); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/cropBoxResizable.js b/library/cropperjs/test/options/cropBoxResizable.js deleted file mode 100644 index 37093642b..000000000 --- a/library/cropperjs/test/options/cropBoxResizable.js +++ /dev/null @@ -1,65 +0,0 @@ -QUnit.test('options#cropBoxResizable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(12); - - return new Cropper(image, { - // cropBoxResizable: true, - - ready: function () { - var cropper = this.cropper; - var line = util.getByClass(cropper.cropBox, 'cropper-line'); - var point = util.getByClass(cropper.cropBox, 'cropper-point'); - - assert.notOk(util.hasClass(line[0], 'cropper-hidden')); - assert.notOk(util.hasClass(line[1], 'cropper-hidden')); - assert.notOk(util.hasClass(line[2], 'cropper-hidden')); - assert.notOk(util.hasClass(line[3], 'cropper-hidden')); - assert.notOk(util.hasClass(point[0], 'cropper-hidden')); - assert.notOk(util.hasClass(point[1], 'cropper-hidden')); - assert.notOk(util.hasClass(point[2], 'cropper-hidden')); - assert.notOk(util.hasClass(point[3], 'cropper-hidden')); - assert.notOk(util.hasClass(point[4], 'cropper-hidden')); - assert.notOk(util.hasClass(point[5], 'cropper-hidden')); - assert.notOk(util.hasClass(point[6], 'cropper-hidden')); - assert.notOk(util.hasClass(point[7], 'cropper-hidden')); - - done(); - } - }); -}); - -QUnit.test('options#cropBoxResizable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(12); - - return new Cropper(image, { - cropBoxResizable: false, - - ready: function () { - var cropper = this.cropper; - var line = util.getByClass(cropper.cropBox, 'cropper-line'); - var point = util.getByClass(cropper.cropBox, 'cropper-point'); - - assert.ok(util.hasClass(line[0], 'cropper-hidden')); - assert.ok(util.hasClass(line[1], 'cropper-hidden')); - assert.ok(util.hasClass(line[2], 'cropper-hidden')); - assert.ok(util.hasClass(line[3], 'cropper-hidden')); - assert.ok(util.hasClass(point[0], 'cropper-hidden')); - assert.ok(util.hasClass(point[1], 'cropper-hidden')); - assert.ok(util.hasClass(point[2], 'cropper-hidden')); - assert.ok(util.hasClass(point[3], 'cropper-hidden')); - assert.ok(util.hasClass(point[4], 'cropper-hidden')); - assert.ok(util.hasClass(point[5], 'cropper-hidden')); - assert.ok(util.hasClass(point[6], 'cropper-hidden')); - assert.ok(util.hasClass(point[7], 'cropper-hidden')); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/cropend.js b/library/cropperjs/test/options/cropend.js deleted file mode 100644 index abfe815c0..000000000 --- a/library/cropperjs/test/options/cropend.js +++ /dev/null @@ -1,24 +0,0 @@ -QUnit.test('options#cropend', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - ready: function () { - var PointerEvent = window.PointerEvent; - var cropper = this.cropper; - - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup'); - - done(); - }, - - cropend: function (e) { - assert.strictEqual(e.detail.action, 'crop'); - } - }); -}); diff --git a/library/cropperjs/test/options/cropmove.js b/library/cropperjs/test/options/cropmove.js deleted file mode 100644 index fa20f4011..000000000 --- a/library/cropperjs/test/options/cropmove.js +++ /dev/null @@ -1,24 +0,0 @@ -QUnit.test('options#cropmove', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - ready: function () { - var PointerEvent = window.PointerEvent; - var cropper = this.cropper; - - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup'); - - done(); - }, - - cropmove: function (e) { - assert.strictEqual(e.detail.action, 'crop'); - } - }); -}); diff --git a/library/cropperjs/test/options/cropstart.js b/library/cropperjs/test/options/cropstart.js deleted file mode 100644 index f547269cd..000000000 --- a/library/cropperjs/test/options/cropstart.js +++ /dev/null @@ -1,56 +0,0 @@ -QUnit.test('options#cropstart', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - ready: function () { - var PointerEvent = window.PointerEvent; - var cropper = this.cropper; - - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup'); - - done(); - }, - - cropstart: function (e) { - assert.strictEqual(e.detail.action, 'crop'); - } - }); -}); - -QUnit.test('options#cropstart: default prevented', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(0); - - return new Cropper(image, { - ready: function () { - var PointerEvent = window.PointerEvent; - var cropper = this.cropper; - - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerdown' : 'mousedown'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointermove' : 'mousemove'); - util.dispatchEvent(cropper.dragBox, PointerEvent ? 'pointerup' : 'mouseup'); - - done(); - }, - - cropstart: function (e) { - e.preventDefault(); - }, - - cropmove: function () { - assert.ok(false); - }, - - cropend: function () { - assert.ok(false); - } - }); -}); diff --git a/library/cropperjs/test/options/data.js b/library/cropperjs/test/options/data.js deleted file mode 100644 index e9da6a4dd..000000000 --- a/library/cropperjs/test/options/data.js +++ /dev/null @@ -1,35 +0,0 @@ -QUnit.test('options#data', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var initialData = { - x: 360, - y: 450, - width: 640, - height: 360, - rotate: 45, - scaleX: -1, - scaleY: -1 - }; - - assert.expect(7); - - return new Cropper(image, { - data: initialData, - - ready: function () { - var cropper = this.cropper; - var data = cropper.getData(true); - - assert.strictEqual(data.x, initialData.x); - assert.strictEqual(data.y, initialData.y); - assert.strictEqual(data.width, initialData.width); - assert.strictEqual(data.height, initialData.height); - assert.strictEqual(data.rotate, initialData.rotate); - assert.strictEqual(data.scaleX, initialData.scaleX); - assert.strictEqual(data.scaleY, initialData.scaleY); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/dragMode.js b/library/cropperjs/test/options/dragMode.js deleted file mode 100644 index 57f31ff13..000000000 --- a/library/cropperjs/test/options/dragMode.js +++ /dev/null @@ -1,60 +0,0 @@ -QUnit.test('options#dragMode: crop', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // dragMode: 'crop', - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.dragBox.dataset.action, 'crop'); - - done(); - } - }); -}); - -QUnit.test('options#dragMode: move', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - dragMode: 'move', - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.dragBox.dataset.action, 'move'); - - done(); - } - }); -}); - - -QUnit.test('options#dragMode: none', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - dragMode: 'none', - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.dragBox.dataset.action, 'none'); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/guides.js b/library/cropperjs/test/options/guides.js deleted file mode 100644 index 298c3ad3a..000000000 --- a/library/cropperjs/test/options/guides.js +++ /dev/null @@ -1,43 +0,0 @@ -QUnit.test('options#guides: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - // guides: true, - - ready: function () { - var cropper = this.cropper; - var dashed = util.getByClass(cropper.cropBox, 'cropper-dashed'); - - assert.notOk(util.hasClass(dashed[0], 'cropper-hidden')); - assert.notOk(util.hasClass(dashed[1], 'cropper-hidden')); - - done(); - } - }); -}); - -QUnit.test('options#guides: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - guides: false, - - ready: function () { - var cropper = this.cropper; - var dashed = util.getByClass(cropper.cropBox, 'cropper-dashed'); - - assert.ok(util.hasClass(dashed[0], 'cropper-hidden')); - assert.ok(util.hasClass(dashed[1], 'cropper-hidden')); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/highlight.js b/library/cropperjs/test/options/highlight.js deleted file mode 100644 index a1db4687f..000000000 --- a/library/cropperjs/test/options/highlight.js +++ /dev/null @@ -1,41 +0,0 @@ -QUnit.test('options#highlight: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // highlight: true, - - ready: function () { - var cropper = this.cropper; - var face = util.getByClass(cropper.cropBox, 'cropper-face'); - - assert.notOk(util.hasClass(face[0], 'cropper-invisible')); - - done(); - } - }); -}); - -QUnit.test('options#highlight: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - highlight: false, - - ready: function () { - var cropper = this.cropper; - var face = util.getByClass(cropper.cropBox, 'cropper-face'); - - assert.ok(util.hasClass(face[0], 'cropper-invisible')); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minCanvasHeight.js b/library/cropperjs/test/options/minCanvasHeight.js deleted file mode 100644 index c9745a9b1..000000000 --- a/library/cropperjs/test/options/minCanvasHeight.js +++ /dev/null @@ -1,23 +0,0 @@ -QUnit.test('options#minCanvasHeight', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minCanvasHeight = 270; - - assert.expect(1); - - return new Cropper(image, { - minCanvasHeight: minCanvasHeight, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.setCanvasData({ - height: 180 - }).getCanvasData(); - - assert.strictEqual(Math.round(canvasData.height), minCanvasHeight); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minCanvasWidth.js b/library/cropperjs/test/options/minCanvasWidth.js deleted file mode 100644 index 61601e4f9..000000000 --- a/library/cropperjs/test/options/minCanvasWidth.js +++ /dev/null @@ -1,23 +0,0 @@ -QUnit.test('options#minCanvasWidth', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minCanvasWidth = 480; - - assert.expect(1); - - return new Cropper(image, { - minCanvasWidth: minCanvasWidth, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.setCanvasData({ - width: 320 - }).getCanvasData(); - - assert.strictEqual(Math.round(canvasData.width), minCanvasWidth); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minContainerHeight.js b/library/cropperjs/test/options/minContainerHeight.js deleted file mode 100644 index 85d7a70ef..000000000 --- a/library/cropperjs/test/options/minContainerHeight.js +++ /dev/null @@ -1,21 +0,0 @@ -QUnit.test('options#minContainerHeight', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minContainerHeight = 361; - - assert.expect(1); - - return new Cropper(image, { - minContainerHeight: minContainerHeight, - - ready: function () { - var cropper = this.cropper; - var containerData = cropper.getContainerData(); - - assert.strictEqual(Math.round(containerData.height), minContainerHeight); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minContainerWidth.js b/library/cropperjs/test/options/minContainerWidth.js deleted file mode 100644 index 2119cc96e..000000000 --- a/library/cropperjs/test/options/minContainerWidth.js +++ /dev/null @@ -1,21 +0,0 @@ -QUnit.test('options#minContainerWidth', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minContainerWidth = 641; - - assert.expect(1); - - return new Cropper(image, { - minContainerWidth: minContainerWidth, - - ready: function () { - var cropper = this.cropper; - var containerData = cropper.getContainerData(); - - assert.strictEqual(Math.round(containerData.width), minContainerWidth); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minCropBoxHeight.js b/library/cropperjs/test/options/minCropBoxHeight.js deleted file mode 100644 index ccf50aefe..000000000 --- a/library/cropperjs/test/options/minCropBoxHeight.js +++ /dev/null @@ -1,23 +0,0 @@ -QUnit.test('options#minCropBoxHeight', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minCropBoxHeight = 150; - - assert.expect(1); - - return new Cropper(image, { - minCropBoxHeight: minCropBoxHeight, - - ready: function () { - var cropper = this.cropper; - var cropBoxData = cropper.setCropBoxData({ - height: 100 - }).getCropBoxData(); - - assert.strictEqual(Math.round(cropBoxData.height), minCropBoxHeight); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/minCropBoxWidth.js b/library/cropperjs/test/options/minCropBoxWidth.js deleted file mode 100644 index acde5c366..000000000 --- a/library/cropperjs/test/options/minCropBoxWidth.js +++ /dev/null @@ -1,23 +0,0 @@ -QUnit.test('options#minCropBoxWidth', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - var minCropBoxWidth = 300; - - assert.expect(1); - - return new Cropper(image, { - minCropBoxWidth: minCropBoxWidth, - - ready: function () { - var cropper = this.cropper; - var cropBoxData = cropper.setCropBoxData({ - width: 200 - }).getCropBoxData(); - - assert.strictEqual(Math.round(cropBoxData.width), minCropBoxWidth); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/modal.js b/library/cropperjs/test/options/modal.js deleted file mode 100644 index 7284cb264..000000000 --- a/library/cropperjs/test/options/modal.js +++ /dev/null @@ -1,39 +0,0 @@ -QUnit.test('options#modal: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // modal: true, - - ready: function () { - var cropper = this.cropper; - - assert.ok(util.hasClass(cropper.dragBox, 'cropper-modal')); - - done(); - } - }); -}); - -QUnit.test('options#modal: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - modal: false, - - ready: function () { - var cropper = this.cropper; - - assert.notOk(util.hasClass(cropper.dragBox, 'cropper-modal')); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/movable.js b/library/cropperjs/test/options/movable.js deleted file mode 100644 index 0e2c53506..000000000 --- a/library/cropperjs/test/options/movable.js +++ /dev/null @@ -1,45 +0,0 @@ -QUnit.test('options#movable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - // movable: true, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.getCanvasData(); - var changedCanvasData = cropper.move(10, 10).getCanvasData(); - - assert.strictEqual(changedCanvasData.left, canvasData.left + 10); - assert.strictEqual(changedCanvasData.top, canvasData.top + 10); - - done(); - } - }); -}); - -QUnit.test('options#movable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - movable: false, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.getCanvasData(); - var changedCanvasData = cropper.move(10, 10).getCanvasData(); - - assert.strictEqual(changedCanvasData.left, canvasData.left); - assert.strictEqual(changedCanvasData.top, canvasData.top); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/ready.js b/library/cropperjs/test/options/ready.js deleted file mode 100644 index e09e8369c..000000000 --- a/library/cropperjs/test/options/ready.js +++ /dev/null @@ -1,15 +0,0 @@ -QUnit.test('options#ready', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - ready: function () { - assert.ok(true); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/rotatable.js b/library/cropperjs/test/options/rotatable.js deleted file mode 100644 index 992e9362f..000000000 --- a/library/cropperjs/test/options/rotatable.js +++ /dev/null @@ -1,39 +0,0 @@ -QUnit.test('options#rotatable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // rotatable: true, - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.rotate(90).getImageData().rotate, 90); - - done(); - } - }); -}); - -QUnit.test('options#rotatable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - rotatable: false, - - ready: function () { - var cropper = this.cropper; - - assert.strictEqual(cropper.rotate(90).getImageData().rotate, undefined); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/scalable.js b/library/cropperjs/test/options/scalable.js deleted file mode 100644 index c523eaf63..000000000 --- a/library/cropperjs/test/options/scalable.js +++ /dev/null @@ -1,43 +0,0 @@ -QUnit.test('options#scalable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - // scalable: true, - - ready: function () { - var cropper = this.cropper; - var imageData = cropper.scale(-1, -1).getImageData(); - - assert.strictEqual(imageData.scaleX, -1); - assert.strictEqual(imageData.scaleY, -1); - - done(); - } - }); -}); - -QUnit.test('options#scalable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - scalable: false, - - ready: function () { - var cropper = this.cropper; - var imageData = cropper.scale(-1, -1).getImageData(); - - assert.strictEqual(imageData.scaleX, undefined); - assert.strictEqual(imageData.scaleY, undefined); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/toggleDragModeOnDblclick.js b/library/cropperjs/test/options/toggleDragModeOnDblclick.js deleted file mode 100644 index df64327b2..000000000 --- a/library/cropperjs/test/options/toggleDragModeOnDblclick.js +++ /dev/null @@ -1,45 +0,0 @@ -QUnit.test('options#toggleDragModeOnDblclick: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - // toggleDragModeOnDblclick: true, - - ready: function () { - var cropper = this.cropper; - var dragBox = cropper.dragBox; - - util.dispatchEvent(dragBox, 'dblclick'); - assert.ok(util.hasClass(dragBox, 'cropper-move')); - assert.strictEqual(dragBox.dataset.action, 'move'); - - done(); - } - }); -}); - -QUnit.test('options#toggleDragModeOnDblclick: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - toggleDragModeOnDblclick: false, - - ready: function () { - var cropper = this.cropper; - var dragBox = cropper.dragBox; - - util.dispatchEvent(dragBox, 'dblclick'); - assert.ok(util.hasClass(dragBox, 'cropper-crop')); - assert.strictEqual(dragBox.dataset.action, 'crop'); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/viewMode.js b/library/cropperjs/test/options/viewMode.js deleted file mode 100644 index e39ec5fc1..000000000 --- a/library/cropperjs/test/options/viewMode.js +++ /dev/null @@ -1,100 +0,0 @@ -QUnit.test('options#viewMode: 0', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(4); - - return new Cropper(image, { - // viewMode: 0, - - ready: function () { - var cropper = this.cropper; - var canvasData = { - left: 100, - top: 100, - width: 160, - height: 90 - }; - var changedCanvasData = cropper.setCanvasData(canvasData).getCanvasData(); - - assert.strictEqual(changedCanvasData.left, canvasData.left); - assert.strictEqual(changedCanvasData.top, canvasData.top); - assert.strictEqual(changedCanvasData.width, canvasData.width); - assert.strictEqual(changedCanvasData.height, canvasData.height); - - done(); - } - }); -}); - -QUnit.test('options#viewMode: 1', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - viewMode: 1, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out - var cropBoxData = cropper.getCropBoxData(); - - assert.ok(canvasData.width >= cropBoxData.width); - assert.ok(canvasData.height >= cropBoxData.height); - - done(); - } - }); -}); - -QUnit.test('options#viewMode: 2', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - viewMode: 2, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out - var containerData = cropper.getContainerData(); - - assert.ok(canvasData.width >= containerData.width || - canvasData.height >= containerData.height); - - done(); - } - }); -}); - -QUnit.test('options#viewMode: 3', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(4); - - return new Cropper(image, { - viewMode: 3, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.zoom(-0.5).getCanvasData(); // Zoom out - var containerData = cropper.getContainerData(); - - assert.ok(canvasData.left <= 0); - assert.ok(canvasData.top <= 0); - assert.ok(canvasData.width >= containerData.width); - assert.ok(canvasData.height >= containerData.height); - - done(); - } - }); -}); diff --git a/library/cropperjs/test/options/zoom.js b/library/cropperjs/test/options/zoom.js deleted file mode 100644 index 51ebc76ad..000000000 --- a/library/cropperjs/test/options/zoom.js +++ /dev/null @@ -1,46 +0,0 @@ -QUnit.test('options#zoom', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(3); - - return new Cropper(image, { - ready: function () { - var cropper = this.cropper; - - cropper.zoom(0.1); - - done(); - }, - - zoom: function (e) { - assert.ok(e.detail.ratio > 0); - assert.ok(e.detail.oldRatio > 0); - assert.ok(e.detail.ratio > e.detail.oldRatio); - } - }); -}); - -QUnit.test('options#zoom: default prevented', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.getCanvasData(); - - assert.deepEqual(cropper.zoom(0.1).getCanvasData(), canvasData); - - done(); - }, - - zoom: function (e) { - e.preventDefault(); - } - }); -}); diff --git a/library/cropperjs/test/options/zoomOnWheel.js b/library/cropperjs/test/options/zoomOnWheel.js deleted file mode 100644 index 1a1bf6dce..000000000 --- a/library/cropperjs/test/options/zoomOnWheel.js +++ /dev/null @@ -1,47 +0,0 @@ -QUnit.test('options#zoomOnWheel: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(1); - - return new Cropper(image, { - // zoomOnWheel: true, - - ready: function () { - var cropper = this.cropper; - - util.dispatchEvent(cropper.cropper, 'wheel'); - - done(); - }, - - zoom: function () { - assert.ok(true); - } - }); -}); - -QUnit.test('options#zoomOnWheel: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(0); - - return new Cropper(image, { - zoomOnWheel: false, - - ready: function () { - var cropper = this.cropper; - - util.dispatchEvent(cropper.cropper, 'wheel'); - - done(); - }, - - zoom: function () { - assert.ok(false); - } - }); -}); diff --git a/library/cropperjs/test/options/zoomable.js b/library/cropperjs/test/options/zoomable.js deleted file mode 100644 index 9f8ec6fce..000000000 --- a/library/cropperjs/test/options/zoomable.js +++ /dev/null @@ -1,51 +0,0 @@ -QUnit.test('options#zoomable: true', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(3); - - return new Cropper(image, { - // zoomable: true, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.getCanvasData(); - var changedCanvasData = cropper.zoom(0.1).getCanvasData(); - - assert.ok(changedCanvasData.width > canvasData.width); - assert.ok(changedCanvasData.height > canvasData.height); - - done(); - }, - zoom: function () { - assert.ok(true); - } - }); -}); - -QUnit.test('options#zoomable: false', function (assert) { - var done = assert.async(); - var util = window.Util; - var image = util.createImage(); - - assert.expect(2); - - return new Cropper(image, { - zoomable: false, - - ready: function () { - var cropper = this.cropper; - var canvasData = cropper.getCanvasData(); - var changedCanvasData = cropper.zoom(0.1).getCanvasData(); - - assert.ok(changedCanvasData.width === canvasData.width); - assert.ok(changedCanvasData.height === canvasData.height); - - done(); - }, - zoom: function () { - assert.ok(false); - } - }); -}); |