How to use the @jupyterlab/testutils.NBTestUtils.defaultRenderMime 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 / panel.spec.ts View on Github external
it('should create a notebook widget', () => {
          const options = {
            contentFactory: contentFactory,
            rendermime: NBTestUtils.defaultRenderMime(),
            mimeTypeService: NBTestUtils.mimeTypeService
          };
          expect(contentFactory.createNotebook(options)).to.be.an.instanceof(
            Notebook
          );
        });
      });
github jupyterlab / jupyterlab / tests / test-notebook / src / actions.spec.ts View on Github external
describe('@jupyterlab/notebook', () => {
  const rendermime = NBTestUtils.defaultRenderMime();

  describe('NotebookActions', () => {
    let widget: Notebook;
    let session: ClientSession;
    let ipySession: ClientSession;

    before(async () => {
      session = await createClientSession();
      ipySession = await createClientSession({
        kernelPreference: { name: 'ipython' }
      });
      await Promise.all([ipySession.initialize(), session.initialize()]);
      await Promise.all([ipySession.kernel.ready, session.kernel.ready]);
    });

    beforeEach(() => {
github jupyterlab / jupyterlab-data-explorer / tests / test-cells / src / widget.spec.ts View on Github external
MarkdownCellModel,
  CellFooter,
  CellHeader,
  InputArea
} from '@jupyterlab/cells';

import { OutputArea, OutputPrompt } from '@jupyterlab/outputarea';

import {
  createClientSession,
  framePromise,
  NBTestUtils
} from '@jupyterlab/testutils';

const RENDERED_CLASS = 'jp-mod-rendered';
const rendermime = NBTestUtils.defaultRenderMime();

class LogBaseCell extends Cell {
  methods: string[] = [];

  constructor() {
    super({
      model: new CellModel({}),
      contentFactory: NBTestUtils.createBaseCellFactory()
    });
  }

  protected onAfterAttach(msg: Message): void {
    super.onAfterAttach(msg);
    this.methods.push('onAfterAttach');
  }
github jupyterlab / jupyterlab / tests / test-notebook / src / widgetfactory.spec.ts View on Github external
import { toArray } from '@lumino/algorithm';

import { ToolbarButton } from '@jupyterlab/apputils';

import { DocumentRegistry, Context } from '@jupyterlab/docregistry';

import {
  INotebookModel,
  NotebookPanel,
  NotebookWidgetFactory
} from '@jupyterlab/notebook';

import { initNotebookContext, NBTestUtils } from '@jupyterlab/testutils';

const contentFactory = NBTestUtils.createNotebookPanelFactory();
const rendermime = NBTestUtils.defaultRenderMime();

function createFactory(
  toolbarFactory?: (widget: NotebookPanel) => DocumentRegistry.IToolbarItem[]
): NotebookWidgetFactory {
  return new NotebookWidgetFactory({
    name: 'notebook',
    fileTypes: ['notebook'],
    rendermime,
    toolbarFactory,
    contentFactory,
    mimeTypeService: NBTestUtils.mimeTypeService,
    editorConfig: NBTestUtils.defaultEditorConfig
  });
}

describe('@jupyterlab/notebook', () => {
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / actions.spec.ts View on Github external
describe('@jupyterlab/notebook', () => {
  const rendermime = NBTestUtils.defaultRenderMime();

  describe('NotebookActions', () => {
    let widget: Notebook;
    let session: ClientSession;
    let ipySession: ClientSession;

    before(async () => {
      session = await createClientSession();
      ipySession = await createClientSession({
        kernelPreference: { name: 'ipython' }
      });
      await Promise.all([ipySession.initialize(), session.initialize()]);
      await Promise.all([ipySession.kernel.ready, session.kernel.ready]);
    });

    beforeEach(() => {
github jupyterlab / jupyterlab-data-explorer / tests / test-notebook / src / widget.spec.ts View on Github external
Cell
} from '@jupyterlab/cells';

import { INotebookModel, NotebookModel } from '@jupyterlab/notebook';

import { Notebook, StaticNotebook } from '@jupyterlab/notebook';

import {
  NBTestUtils,
  framePromise,
  signalToPromise
} from '@jupyterlab/testutils';

const contentFactory = NBTestUtils.createNotebookFactory();
const editorConfig = NBTestUtils.defaultEditorConfig;
const rendermime = NBTestUtils.defaultRenderMime();

const options: Notebook.IOptions = {
  rendermime,
  contentFactory,
  mimeTypeService: NBTestUtils.mimeTypeService,
  editorConfig
};

function createWidget(): LogStaticNotebook {
  const model = new NotebookModel();
  const widget = new LogStaticNotebook(options);
  widget.model = model;
  return widget;
}

class LogStaticNotebook extends StaticNotebook {
github jupyterlab / jupyterlab / tests / test-cells / src / widget.spec.ts View on Github external
MarkdownCellModel,
  CellFooter,
  CellHeader,
  InputArea
} from '@jupyterlab/cells';

import { OutputArea, OutputPrompt } from '@jupyterlab/outputarea';

import {
  createClientSession,
  framePromise,
  NBTestUtils
} from '@jupyterlab/testutils';

const RENDERED_CLASS = 'jp-mod-rendered';
const rendermime = NBTestUtils.defaultRenderMime();

class LogBaseCell extends Cell {
  methods: string[] = [];

  constructor() {
    super({
      model: new CellModel({}),
      contentFactory: NBTestUtils.createBaseCellFactory()
    });
  }

  protected onAfterAttach(msg: Message): void {
    super.onAfterAttach(msg);
    this.methods.push('onAfterAttach');
  }
github jupyterlab / jupyterlab / tests / test-notebook / src / widget.spec.ts View on Github external
Cell
} from '@jupyterlab/cells';

import { INotebookModel, NotebookModel } from '@jupyterlab/notebook';

import { Notebook, StaticNotebook } from '@jupyterlab/notebook';

import {
  NBTestUtils,
  framePromise,
  signalToPromise
} from '@jupyterlab/testutils';

const contentFactory = NBTestUtils.createNotebookFactory();
const editorConfig = NBTestUtils.defaultEditorConfig;
const rendermime = NBTestUtils.defaultRenderMime();

const options: Notebook.IOptions = {
  rendermime,
  contentFactory,
  mimeTypeService: NBTestUtils.mimeTypeService,
  editorConfig
};

function createWidget(): LogStaticNotebook {
  const model = new NotebookModel();
  const widget = new LogStaticNotebook(options);
  widget.model = model;
  return widget;
}

class LogStaticNotebook extends StaticNotebook {