diff options
Diffstat (limited to 'library/cropperjs/test/specs/events/crop.spec.js')
-rw-r--r-- | library/cropperjs/test/specs/events/crop.spec.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/library/cropperjs/test/specs/events/crop.spec.js b/library/cropperjs/test/specs/events/crop.spec.js new file mode 100644 index 000000000..04ec1fd10 --- /dev/null +++ b/library/cropperjs/test/specs/events/crop.spec.js @@ -0,0 +1,30 @@ +describe('crop (event)', () => { + it('should trigger the `crop` event', (done) => { + const image = window.createImage(); + + image.addEventListener('crop', (event) => { + expect(event.type).to.equal('crop'); + done(); + }); + + new Cropper(image); + }); + + it('should have expected properties in `event.detail`', (done) => { + const image = window.createImage(); + + image.addEventListener('crop', (event) => { + expect(event.detail).to.be.an('object').that.has.all.keys(['x', 'y', 'width', 'height', 'rotate', 'scaleX', 'scaleY']); + expect(event.detail.x).to.be.a('number'); + expect(event.detail.y).to.be.a('number'); + expect(event.detail.width).to.be.a('number'); + expect(event.detail.height).to.be.a('number'); + expect(event.detail.rotate).to.be.a('number'); + expect(event.detail.scaleX).to.be.a('number'); + expect(event.detail.scaleY).to.be.a('number'); + done(); + }); + + new Cropper(image); + }); +}); |