aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/options/zoomable.js
blob: 9f8ec6fcef199e0947144f3a3e45c3de2c79e378 (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
46
47
48
49
50
51
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);
    }
  });
});