本文整理匯總了TypeScript中@jupyterlab/testutils.NBTestUtils類的典型用法代碼示例。如果您正苦於以下問題:TypeScript NBTestUtils類的具體用法?TypeScript NBTestUtils怎麽用?TypeScript NBTestUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了NBTestUtils類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should change notebook to edit mode if we have a single empty code cell', async () => {
const panel = NBTestUtils.createNotebookPanel(context);
const model = panel.content.model;
expect(model).to.equal(context.model);
await context.initialize(true);
await context.ready;
expect(panel.content.mode).to.equal('edit');
});
示例2: createFactory
import { toArray } from '@phosphor/algorithm';
import { INotebookModel } from '@jupyterlab/notebook';
import { NotebookPanel } from '@jupyterlab/notebook';
import { NotebookWidgetFactory } from '@jupyterlab/notebook';
import { DocumentRegistry, Context } from '@jupyterlab/docregistry';
import { createNotebookContext, NBTestUtils } from '@jupyterlab/testutils';
import { ToolbarButton } from '@jupyterlab/apputils';
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
});
}
示例3: beforeEach
beforeEach(async () => {
context = await createNotebookContext();
await context.initialize(true);
panel = NBTestUtils.createNotebookPanel(context);
context.model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
});