blob: c8df79ee81084c7a25fdabce1fa8715b2c7fd377 (
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
|
describe('destroy (method)', () => {
it('should destroy before ready', () => {
const image = window.createImage();
const cropper = new Cropper(image, {
ready() {
expect.fail(1, 0);
},
});
expect(image.cropper).to.be.an.instanceof(Cropper);
expect(cropper.xhr).to.be.an.instanceof(XMLHttpRequest);
cropper.destroy();
expect(cropper.xhr).to.be.not.exist;
expect(image.cropper).to.be.not.exist;
});
it('should destroy after ready', (done) => {
const image = window.createImage();
const cropper = new Cropper(image, {
ready() {
expect(this.cropper).to.be.an.instanceof(Cropper);
expect(window.getComputedStyle(image).display).to.equal('none');
cropper.destroy();
expect(this.cropper).to.be.not.exist;
expect(window.getComputedStyle(image).display).to.not.equal('none');
done();
},
});
});
});
|