aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/methods/moveTo.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/cropperjs/test/specs/methods/moveTo.spec.js')
-rw-r--r--library/cropperjs/test/specs/methods/moveTo.spec.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/methods/moveTo.spec.js b/library/cropperjs/test/specs/methods/moveTo.spec.js
new file mode 100644
index 000000000..42403b41c
--- /dev/null
+++ b/library/cropperjs/test/specs/methods/moveTo.spec.js
@@ -0,0 +1,29 @@
+describe('moveTo (method)', () => {
+ it('should move to the given coordinate', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+ ready() {
+ const canvasData = cropper.moveTo(100, 100).getCanvasData();
+
+ expect(canvasData.left).to.equal(100);
+ expect(canvasData.top).to.equal(100);
+ done();
+ },
+ });
+ });
+
+ it('should not work when it is not movable', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+ movable: false,
+
+ ready() {
+ const canvasData = cropper.moveTo(100, 100).getCanvasData();
+
+ expect(canvasData.left).to.not.equal(100);
+ expect(canvasData.top).to.not.equal(100);
+ done();
+ },
+ });
+ });
+});