|
@@ -15,6 +15,7 @@ import { JupyterServer } from '@jupyterlab/testutils/lib/start_jupyter_server';
|
|
|
import { Message, MessageLoop } from '@lumino/messaging';
|
|
|
import { Widget } from '@lumino/widgets';
|
|
|
import { generate, simulate } from 'simulate-event';
|
|
|
+import * as nbformat from '@jupyterlab/nbformat';
|
|
|
import {
|
|
|
INotebookModel,
|
|
|
Notebook,
|
|
@@ -37,12 +38,23 @@ afterAll(async () => {
|
|
|
const contentFactory = utils.createNotebookFactory();
|
|
|
const editorConfig = utils.defaultEditorConfig;
|
|
|
const rendermime = utils.defaultRenderMime();
|
|
|
+const notebookConfig = {
|
|
|
+ scrollPastEnd: true,
|
|
|
+ defaultCell: 'code' as nbformat.CellType,
|
|
|
+ recordTiming: false,
|
|
|
+ numberCellsToRenderDirectly: 2,
|
|
|
+ renderCellOnIdle: true,
|
|
|
+ observedTopMargin: '1000px',
|
|
|
+ observedBottomMargin: '1000px',
|
|
|
+ maxNumberOutputs: 50
|
|
|
+};
|
|
|
|
|
|
const options: Notebook.IOptions = {
|
|
|
rendermime,
|
|
|
contentFactory,
|
|
|
mimeTypeService: utils.mimeTypeService,
|
|
|
- editorConfig
|
|
|
+ editorConfig,
|
|
|
+ notebookConfig
|
|
|
};
|
|
|
|
|
|
function createWidget(): LogStaticNotebook {
|
|
@@ -1583,5 +1595,21 @@ describe('@jupyter/notebook', () => {
|
|
|
expect(widget.activeCell).toBe(widget.widgets[1]);
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
+ describe('#virtualNotebook()', () => {
|
|
|
+ it('should render the last cell widget', () => {
|
|
|
+ const model = new NotebookModel();
|
|
|
+ const widget = new StaticNotebook(options);
|
|
|
+ widget.model = model;
|
|
|
+ widget.model!.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ const cell = widget.widgets[5];
|
|
|
+ expect(
|
|
|
+ cell.inputArea.editorWidget.model.value.text.startsWith(
|
|
|
+ 'from IPython.display import Latex'
|
|
|
+ )
|
|
|
+ ).toBe(true);
|
|
|
+ console.log();
|
|
|
+ });
|
|
|
+ });
|
|
|
});
|
|
|
});
|