aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js')
-rw-r--r--library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js b/library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js
new file mode 100644
index 000000000..b67617f1d
--- /dev/null
+++ b/library/cropperjs/test/specs/options/toggleDragModeOnDblclick.spec.js
@@ -0,0 +1,40 @@
+describe('toggleDragModeOnDblclick (option)', () => {
+ it('should toggle drag mode on double click', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+
+ ready() {
+ const { dragBox } = cropper;
+
+ expect(dragBox.className).include('cropper-crop');
+ expect(dragBox.dataset.cropperAction).to.equal('crop');
+ dragBox.dispatchEvent(window.createEvent('dblclick'));
+ expect(dragBox.className).include('cropper-move');
+ expect(dragBox.dataset.cropperAction).to.equal('move');
+ done();
+ },
+ });
+
+ expect(cropper.options.toggleDragModeOnDblclick).to.be.true;
+ });
+
+ it('should not toggle drag mode on double click', (done) => {
+ const image = window.createImage();
+ const cropper = new Cropper(image, {
+ toggleDragModeOnDblclick: false,
+
+ ready() {
+ const { dragBox } = cropper;
+
+ expect(dragBox.className).include('cropper-crop');
+ expect(dragBox.dataset.cropperAction).to.equal('crop');
+ dragBox.dispatchEvent(window.createEvent('dblclick'));
+ expect(dragBox.className).include('cropper-crop');
+ expect(dragBox.dataset.cropperAction).to.equal('crop');
+ done();
+ },
+ });
+
+ expect(cropper.options.toggleDragModeOnDblclick).to.be.false;
+ });
+});