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

      assert.ok(typeof cropper === 'object');
      assert.ok(util.hasClass(image, 'cropper-hidden'));

      cropper.destroy();
      assert.ok(typeof this.cropper === 'undefined');
      assert.notOk(util.hasClass(image, 'cropper-hidden'));

      done();
    }
  });
});