aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/methods/zoomTo.js
blob: dd9e81760bbdc873d1e0414a01318a96c04d1a66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
QUnit.test('methods#zoomTo', 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;
      var imageData = cropper.zoomTo(1).getImageData();
      var canvasData = cropper.getCanvasData();

      assert.strictEqual(imageData.width, imageData.naturalWidth);
      assert.strictEqual(canvasData.width, canvasData.naturalWidth);
      assert.strictEqual(canvasData.naturalWidth, imageData.naturalWidth);

      done();
    }
  });
});