How to use the @jupyterlab/testutils.NBTestUtils.DEFAULT_CONTENT 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-data-explorer / tests / test-docregistry / src / context.spec.ts View on Github external
it('should initialize the model when the file is saved for the first time', async () => {
        const context = await createNotebookContext();
        context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        expect(context.model.cells.canUndo).to.equal(true);
        await context.initialize(true);
        await context.ready;
        expect(context.model.cells.canUndo).to.equal(false);
      });
github jupyterlab / jupyterlab / tests / test-docregistry / src / context.spec.ts View on Github external
it('should initialize the model when the file is reverted for the first time', async () => {
        const context = await initNotebookContext();
        await manager.contents.save(context.path, {
          type: 'notebook',
          format: 'json',
          content: NBTestUtils.DEFAULT_CONTENT
        });
        context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        expect(context.model.cells.canUndo).to.equal(true);
        await context.initialize(false);
        await context.ready;
        expect(context.model.cells.canUndo).to.equal(false);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / widget.spec.ts View on Github external
it('should update the active cell if necessary', () => {
        const widget = createActiveWidget();
        widget.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        widget.activeCellIndex = 1;
        expect(widget.activeCell).to.equal(widget.widgets[1]);
      });
    });
github jupyterlab / jupyterlab / tests / test-notebook / src / model.spec.ts View on Github external
it('should be reset when loading from disk', () => {
        const model = new NotebookModel();
        const cell = model.contentFactory.createCodeCell({});
        model.cells.push(cell);
        model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.equal(-1);
        expect(model.cells.length).to.equal(6);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-docregistry / src / context.spec.ts View on Github external
it('should initialize the model when the file is reverted for the first time', async () => {
        const context = await createNotebookContext();
        await manager.contents.save(context.path, {
          type: 'notebook',
          format: 'json',
          content: NBTestUtils.DEFAULT_CONTENT
        });
        context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        expect(context.model.cells.canUndo).to.equal(true);
        await context.initialize(false);
        await context.ready;
        expect(context.model.cells.canUndo).to.equal(false);
      });
    });
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-data-explorer / tests / test-notebook / src / model.spec.ts View on Github external
it('should serialize the model from JSON', () => {
        const model = new NotebookModel();
        model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        expect(model.cells.length).to.equal(6);
        expect(model.nbformat).to.equal(NBTestUtils.DEFAULT_CONTENT.nbformat);
        expect(model.nbformatMinor).to.equal(nbformat.MINOR_VERSION);
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / widget.spec.ts View on Github external
it('should add the model cells to the layout', () => {
        const widget = new LogStaticNotebook(options);
        const model = new NotebookModel();
        model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
        widget.model = model;
        expect(widget.widgets.length).to.equal(6);
      });
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 / 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);
      });