blob: 40513f4f31bfcf1f9e570685e1c96d0ce9ba76de (
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
|
describe('autoCropArea (option)', () => {
it('should be 80% by default', (done) => {
const image = window.createImage();
const cropper = new Cropper(image, {
ready() {
const canvasData = cropper.getCanvasData();
const cropBoxData = cropper.getCropBoxData();
expect(canvasData.width * 0.8).to.equal(cropBoxData.width);
expect(canvasData.height * 0.8).to.equal(cropBoxData.height);
done();
},
});
expect(cropper.options.autoCropArea).to.equal(0.8);
});
it('should be 100%', (done) => {
const image = window.createImage();
const cropper = new Cropper(image, {
autoCropArea: 1,
ready() {
const canvasData = cropper.getCanvasData();
const cropBoxData = cropper.getCropBoxData();
expect(canvasData.width).to.equal(cropBoxData.width);
expect(canvasData.height).to.equal(cropBoxData.height);
done();
},
});
expect(cropper.options.autoCropArea).to.equal(1);
});
});
|