aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/options/movable.js
blob: 0e2c535069fa3a6ebce5df53e620b30995a9f89a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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();
    }
  });
});