How to use the @jupyterlab/testutils.NBTestUtils.createNotebookPanel 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-notebook / src / notebooktools.spec.ts View on Github external
beforeEach(async () => {
      context0 = await initNotebookContext();
      panel0 = NBTestUtils.createNotebookPanel(context0);
      NBTestUtils.populateNotebook(panel0.content);
      context1 = await initNotebookContext();
      panel1 = NBTestUtils.createNotebookPanel(context1);
      NBTestUtils.populateNotebook(panel1.content);
      tracker = new NotebookTracker({ namespace: 'notebook' });
      await tracker.add(panel0);
      await tracker.add(panel1);
      notebookTools = new NotebookTools({ tracker });
      tabpanel = new TabPanel();
      tabpanel.addWidget(panel0);
      tabpanel.addWidget(panel1);
      tabpanel.addWidget(notebookTools);
      tabpanel.node.style.height = '800px';
      Widget.attach(tabpanel, document.body);
      // Give the posted messages a chance to be handled.
      await sleep();
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / notebooktools.spec.ts View on Github external
beforeEach(async () => {
      context0 = await initNotebookContext();
      panel0 = NBTestUtils.createNotebookPanel(context0);
      NBTestUtils.populateNotebook(panel0.content);
      context1 = await initNotebookContext();
      panel1 = NBTestUtils.createNotebookPanel(context1);
      NBTestUtils.populateNotebook(panel1.content);
      tracker = new NotebookTracker({ namespace: 'notebook' });
      await tracker.add(panel0);
      await tracker.add(panel1);
      notebookTools = new NotebookTools({ tracker });
      tabpanel = new TabPanel();
      tabpanel.addWidget(panel0);
      tabpanel.addWidget(panel1);
      tabpanel.addWidget(notebookTools);
      tabpanel.node.style.height = '800px';
      Widget.attach(tabpanel, document.body);
      // Give the posted messages a chance to be handled.
      await sleep();
github jupyterlab / jupyterlab / tests / test-notebook / src / panel.spec.ts View on Github external
it('should be safe to call more than once', () => {
        const panel = NBTestUtils.createNotebookPanel(context);
        panel.dispose();
        panel.dispose();
        expect(panel.isDisposed).to.equal(true);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / panel.spec.ts View on Github external
it('should get the document context for the widget', () => {
        const panel = NBTestUtils.createNotebookPanel(context);
        expect(panel.context).to.equal(context);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / panel.spec.ts View on Github external
it('should be the toolbar used by the widget', () => {
        const panel = NBTestUtils.createNotebookPanel(context);
        expect(panel.toolbar).to.be.an.instanceof(Toolbar);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / tracker.spec.ts View on Github external
it('should emit a signal when the active cell changes', async () => {
        const tracker = new NotebookTracker({ namespace });
        const panel = NBTestUtils.createNotebookPanel(context);
        let count = 0;
        tracker.activeCellChanged.connect(() => {
          count++;
        });
        panel.content.model!.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        await tracker.add(panel);
        expect(count).to.equal(1);
        panel.content.activeCellIndex = 1;
        expect(count).to.equal(2);
        panel.dispose();
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / panel.spec.ts View on Github external
it('should be the notebook content widget', () => {
        const panel = NBTestUtils.createNotebookPanel(context);
        expect(panel.content).to.be.an.instanceof(Notebook);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
beforeEach(async () => {
        context = await initNotebookContext();
        panel = NBTestUtils.createNotebookPanel(context);
        context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
      });
github jupyterlab / jupyterlab / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
beforeEach(async () => {
        context = await initNotebookContext({ startKernel: true });
        panel = NBTestUtils.createNotebookPanel(context);
        context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / default-toolbar.spec.ts View on Github external
beforeEach(async () => {
      context = await createNotebookContext();
      await context.initialize(true);
      panel = NBTestUtils.createNotebookPanel(context);
      context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
    });