aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/test/specs/options/center.spec.js
blob: 37551435ebb275efe9bee64aefba8dc911aecec0 (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
describe('center (option)', () => {
  it('should show the center cross hair by default', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const center = cropper.cropper.querySelector('.cropper-center');

        expect(window.getComputedStyle(center).display).to.not.equal('none');
        done();
      },
    });

    expect(cropper.options.center).to.be.true;
  });

  it('should hide the center cross hair', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      center: false,

      ready() {
        const center = cropper.cropper.querySelector('.cropper-center');

        expect(window.getComputedStyle(center).display).to.equal('none');
        done();
      },
    });

    expect(cropper.options.center).to.be.false;
  });
});