How to use the @jupyterlab/docregistry.DocumentWidget function in @jupyterlab/docregistry

To help you get started, we’ve selected a few @jupyterlab/docregistry 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 resolve after the reveal and context ready promises', async () => {
        const x = Object.create(null);
        const reveal = sleep(300, x);
        const contextReady = Promise.all([context.ready, x]);
        const widget = new DocumentWidget({ context, content, reveal });
        expect(widget.isRevealed).to.equal(false);

        // Our promise should resolve before the widget reveal promise.
        expect(await Promise.race([widget.revealed, reveal])).to.equal(x);
        // The context ready promise should also resolve first.
        void context.initialize(true);
        expect(
          await Promise.race([widget.revealed, contextReady])
        ).to.deep.equal([undefined, x]);
        // The widget.revealed promise should finally resolve.
        expect(await widget.revealed).to.be.undefined;
      });
    });
github jupyterlab / jupyterlab / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
it('should add the document class', () => {
        const content = new Widget();
        const widget = new DocumentWidget({ content, context });

        manager.adoptWidget(context, widget);
        expect(widget.hasClass('jp-Document')).to.equal(true);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
it('should add the document class', () => {
        const content = new Widget();
        const widget = new DocumentWidget({ content, context });

        manager.adoptWidget(context, widget);
        expect(widget.hasClass('jp-Document')).to.equal(true);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
it('should be called for a message to a tracked widget', () => {
        const content = new Widget();
        const widget = new DocumentWidget({ content, context });

        manager.adoptWidget(context, widget);
        MessageLoop.sendMessage(widget, new Message('foo'));
        expect(manager.methods).to.contain('messageHook');
      });
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 });
    };
github jupyterlab / jupyterlab-data-explorer / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
protected createNewWidget(
    context: DocumentRegistry.Context
  ): IDocumentWidget {
    const content = new Widget();
    const widget = new DocumentWidget({ content, context });
    widget.addClass('WidgetFactory');
    return widget;
  }
}
github jupyterlab / jupyterlab / tests / test-docmanager / src / widgetmanager.spec.ts View on Github external
protected createNewWidget(
    context: DocumentRegistry.Context
  ): IDocumentWidget {
    const content = new Widget();
    const widget = new DocumentWidget({ content, context });
    widget.addClass('WidgetFactory');
    return widget;
  }
}
github jupyterlab / jupyterlab / tests / test-docregistry / src / default.spec.ts View on Github external
protected createNewWidget(
    context: DocumentRegistry.Context
  ): IDocumentWidget {
    const content = new Widget();
    const widget = new DocumentWidget({ content, context });
    widget.addClass('WidgetFactory');
    return widget;
  }
}
github jupyterlab / jupyterlab / tests / test-docmanager / src / manager.spec.ts View on Github external
protected createNewWidget(
    context: DocumentRegistry.Context
  ): IDocumentWidget {
    const content = new Widget();
    const widget = new DocumentWidget({ content, context });
    widget.addClass('WidgetFactory');
    return widget;
  }
}
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / imageviewer / src / widget.ts View on Github external
protected createNewWidget(
    context: DocumentRegistry.IContext
  ): IDocumentWidget {
    const content = new ImageViewer(context);
    const widget = new DocumentWidget({ content, context });
    return widget;
  }
}