RepositorySys/wwwroot/cropperjs-main/test/specs/options/checkCrossOrigin.spec.js

(完整代码) 1KB

describe('checkCrossOrigin (option)', () => {
  const crossOriginImageURL = 'https://fengyuanchen.github.io/cropperjs/images/picture.jpg';

  it('should check cross origin by default', (done) => {
    const image = window.createImage({
      src: crossOriginImageURL,
    });
    const cropper = new Cropper(image, {
      ready() {
        expect(cropper.image.crossOrigin).to.equal('anonymous');
        expect(cropper.image.src).to.include('timestamp');
        done();
      },
    });

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

  it('should not check cross origin', (done) => {
    const image = window.createImage({
      src: crossOriginImageURL,
    });
    const cropper = new Cropper(image, {
      checkCrossOrigin: false,

      ready() {
        expect(cropper.image.crossOrigin).to.be.null;
        expect(cropper.image.src).to.not.include('timestamp');
        done();
      },
    });

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

  it('should add timestamp even though the image has the `crossOrigin` attribute', (done) => {
    const image = window.createImage({
      src: crossOriginImageURL,
      crossOrigin: 'anonymous',
    });
    const cropper = new Cropper(image, {
      ready() {
        expect(cropper.image.crossOrigin).to.equal('anonymous');
        expect(cropper.image.src).to.include('timestamp');
        done();
      },
    });
  });
});

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。