本文整理汇总了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);
});