aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/events/ready.spec.js
blob: fd88314f0ca9b22f6513fd188374743dbd5b5179 (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
describe('ready (event)', () => {
  it('should trigger the `ready` event', (done) => {
    const image = window.createImage();

    image.addEventListener('ready', (event) => {
      expect(event.type).to.equal('ready');
      done();
    });

    new Cropper(image);
  });

  it('should trigger the `crop` event even though default prevented', (done) => {
    const image = window.createImage();

    image.addEventListener('ready', (event) => {
      event.preventDefault();
    });

    image.addEventListener('crop', () => {
      done();
    });

    new Cropper(image);
  });
});