Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
);
});
});
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(() => {
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');
}
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', () => {
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(() => {
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 {
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');
}
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 {