How to use the @jupyterlab/testutils.createFileContext function in @jupyterlab/testutils

To help you get started, we’ve selected a few @jupyterlab/testutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
it('should create a new widget given a document model and a context', () => {
        const factory = createFactory();
        const context = createFileContext();
        const widget = factory.createNew(context);
        expect(widget).to.be.an.instanceof(Widget);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / default.spec.ts View on Github external
it('should create a new widget given a document model and a context', () => {
        const factory = createFactory();
        const context = createFileContext();
        const widget = factory.createNew(context);
        expect(widget).to.be.an.instanceof(Widget);
      });
    });
github jupyterlab / jupyterlab / tests / test-imageviewer / src / widget.spec.ts View on Github external
it('should create an image document widget', () => {
      const factory = new ImageViewerFactory({
        name: 'Image',
        modelName: 'base64',
        fileTypes: ['png'],
        defaultFor: ['png']
      });
      const context = createFileContext(IMAGE.path);
      const d = factory.createNew(context);
      expect(d).to.be.an.instanceof(DocumentWidget);
      expect(d.content).to.be.an.instanceof(ImageViewer);
    });
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-imageviewer / src / widget.spec.ts View on Github external
it('should create an image document widget', () => {
      const factory = new ImageViewerFactory({
        name: 'Image',
        modelName: 'base64',
        fileTypes: ['png'],
        defaultFor: ['png']
      });
      const context = createFileContext(IMAGE.path);
      const d = factory.createNew(context);
      expect(d).to.be.an.instanceof(DocumentWidget);
      expect(d.content).to.be.an.instanceof(ImageViewer);
    });
  });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / default.spec.ts View on Github external
it('should call createNew in default implementation', () => {
        const factory = createFactory();
        const context = createFileContext();
        const widget = factory.createNew(context);
        const clonedWidget: IDocumentWidget = factory.clone(widget, context);
        expect(clonedWidget).to.not.equal(widget);
        expect(clonedWidget.hasClass('WidgetFactory')).to.be.true;
        expect(clonedWidget.context).to.equal(widget.context);
      });
    });
github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
const setup = () => {
      context = createFileContext(undefined, manager);
      content = new Widget();
      widget = new DocumentWidget({ context, content });
    };
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / default.spec.ts View on Github external
const setup = () => {
      context = createFileContext(undefined, manager);
      content = new Widget();
      widget = new DocumentWidget({ context, content });
    };