aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/methods/clear.js
blob: 6510ebad29e9568a735ec8cfe2008fd9ad049c2b (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
QUnit.test('methods#clear', function (assert) {
  var done = assert.async();
  var util = window.Util;
  var image = util.createImage();

  assert.expect(4);

  return new Cropper(image, {
    ready: function () {
      var cropper = this.cropper;

      cropper.clear();
      assert.notOk(cropper.cropped);
      assert.deepEqual(cropper.getData(), {
        x: 0,
        y: 0,
        width: 0,
        height: 0,
        rotate: 0,
        scaleX: 1,
        scaleY: 1
      });
      assert.deepEqual(cropper.getCropBoxData(), {});
      assert.ok(util.hasClass(cropper.cropBox, 'cropper-hidden'));

      done();
    }
  });
});