RepositorySys/wwwroot/cropperjs-main/test/specs/methods/disable.spec.js

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

describe('disable (method)', () => {
  it('should be disabled after call the method', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        expect(cropper.disabled).to.be.false;
        expect(cropper.cropper.className).to.not.include('cropper-disabled');
        cropper.disable();
        expect(cropper.disabled).to.be.true;
        expect(cropper.cropper.className).to.include('cropper-disabled');
        done();
      },
    });
  });

  it('should disable the `crop` method', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      autoCrop: false,

      ready() {
        expect(cropper.cropped).to.be.false;
        cropper.disable().crop();
        expect(cropper.cropped).to.be.false;
        done();
      },
    });
  });

  it('should disable the `reset` method', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        const canvasData = cropper.moveTo(0).getCanvasData();

        cropper.disable().reset();
        expect(cropper.getCanvasData()).to.deep.equal(canvasData);
        done();
      },
    });
  });

  it('should disable the `clear` method', (done) => {
    const image = window.createImage();
    const cropper = new Cropper(image, {
      ready() {
        expect(cropper.cropped).to.be.true;
        cropper.disable().clear();
        expect(cropper.cropped).to.be.true;
        done();
      },
    });
  });

  it('should disable the `replace` method', (done) => {
    const image = window.createImage();
    const imageURL = image.src;
    const cropper = new Cropper(image, {
      ready() {
        if (!cropper.replaced) {
后面还有 218 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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