|
@@ -1,7 +1,6 @@
|
|
|
// Copyright (c) Jupyter Development Team.
|
|
|
-// Distributed under the terms of the Modified BSD License.
|
|
|
|
|
|
-import { expect } from 'chai';
|
|
|
+import 'jest';
|
|
|
|
|
|
import { ArrayExt, toArray } from '@lumino/algorithm';
|
|
|
|
|
@@ -9,18 +8,20 @@ import { CodeCellModel } from '@jupyterlab/cells';
|
|
|
|
|
|
import * as nbformat from '@jupyterlab/nbformat';
|
|
|
|
|
|
-import { NotebookModel } from '@jupyterlab/notebook';
|
|
|
+import { NotebookModel } from '../src';
|
|
|
|
|
|
import { ModelDB } from '@jupyterlab/observables';
|
|
|
|
|
|
-import { acceptDialog, NBTestUtils } from '@jupyterlab/testutils';
|
|
|
+import { acceptDialog } from '@jupyterlab/testutils';
|
|
|
+
|
|
|
+import * as utils from './utils';
|
|
|
|
|
|
describe('@jupyterlab/notebook', () => {
|
|
|
describe('NotebookModel', () => {
|
|
|
describe('#constructor()', () => {
|
|
|
it('should create a notebook model', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model).to.be.an.instanceof(NotebookModel);
|
|
|
+ expect(model).toBeInstanceOf(NotebookModel);
|
|
|
});
|
|
|
|
|
|
it('should accept an optional language preference', () => {
|
|
@@ -28,13 +29,13 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const lang = model.metadata.get(
|
|
|
'language_info'
|
|
|
) as nbformat.ILanguageInfoMetadata;
|
|
|
- expect(lang.name).to.equal('python');
|
|
|
+ expect(lang.name).toBe('python');
|
|
|
});
|
|
|
|
|
|
it('should accept an optional factory', () => {
|
|
|
const contentFactory = new NotebookModel.ContentFactory({});
|
|
|
const model = new NotebookModel({ contentFactory });
|
|
|
- expect(model.contentFactory.codeCellContentFactory).to.equal(
|
|
|
+ expect(model.contentFactory.codeCellContentFactory).toBe(
|
|
|
contentFactory.codeCellContentFactory
|
|
|
);
|
|
|
});
|
|
@@ -45,14 +46,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const model = new NotebookModel();
|
|
|
let called = false;
|
|
|
model.metadata.changed.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model.metadata);
|
|
|
- expect(args.key).to.equal('foo');
|
|
|
- expect(args.oldValue).to.be.undefined;
|
|
|
- expect(args.newValue).to.equal(1);
|
|
|
+ expect(sender).toBe(model.metadata);
|
|
|
+ expect(args.key).toBe('foo');
|
|
|
+ expect(args.oldValue).toBeUndefined();
|
|
|
+ expect(args.newValue).toBe(1);
|
|
|
called = true;
|
|
|
});
|
|
|
model.metadata.set('foo', 1);
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should not be emitted when the value does not change', () => {
|
|
@@ -63,7 +64,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.metadata.set('foo', 1);
|
|
|
- expect(called).to.equal(false);
|
|
|
+ expect(called).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -72,9 +73,9 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const model = new NotebookModel();
|
|
|
const cell = model.contentFactory.createCodeCell({});
|
|
|
model.cells.push(cell);
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
- expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).to.equal(-1);
|
|
|
- expect(model.cells.length).to.equal(6);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ expect(ArrayExt.firstIndexOf(toArray(model.cells), cell)).toBe(-1);
|
|
|
+ expect(model.cells.length).toBe(6);
|
|
|
});
|
|
|
|
|
|
it('should allow undoing a change', () => {
|
|
@@ -82,14 +83,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const cell = model.contentFactory.createCodeCell({});
|
|
|
cell.value.text = 'foo';
|
|
|
model.cells.push(cell);
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
model.cells.undo();
|
|
|
- expect(model.cells.length).to.equal(1);
|
|
|
- expect(model.cells.get(0).value.text).to.equal('foo');
|
|
|
- expect(model.cells.get(0)).to.equal(cell); // should be ===.
|
|
|
+ expect(model.cells.length).toBe(1);
|
|
|
+ expect(model.cells.get(0).value.text).toBe('foo');
|
|
|
+ expect(model.cells.get(0)).toBe(cell); // should be ===.
|
|
|
});
|
|
|
|
|
|
- context('cells `changed` signal', () => {
|
|
|
+ describe('cells `changed` signal', () => {
|
|
|
it('should emit a `contentChanged` signal upon cell addition', () => {
|
|
|
const model = new NotebookModel();
|
|
|
const cell = model.contentFactory.createCodeCell({});
|
|
@@ -98,7 +99,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.cells.push(cell);
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should emit a `contentChanged` signal upon cell removal', () => {
|
|
@@ -110,7 +111,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.cells.remove(0);
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should emit a `contentChanged` signal upon cell move', () => {
|
|
@@ -124,14 +125,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.cells.move(0, 1);
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should set the dirty flag', () => {
|
|
|
const model = new NotebookModel();
|
|
|
const cell = model.contentFactory.createCodeCell({});
|
|
|
model.cells.push(cell);
|
|
|
- expect(model.dirty).to.equal(true);
|
|
|
+ expect(model.dirty).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -152,7 +153,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.metadata.set('foo', 'bar');
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should set the dirty flag', () => {
|
|
@@ -161,7 +162,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
model.cells.push(cell);
|
|
|
model.dirty = false;
|
|
|
cell.value.text = 'foo';
|
|
|
- expect(model.dirty).to.equal(true);
|
|
|
+ expect(model.dirty).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -169,7 +170,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
describe('#contentFactory', () => {
|
|
|
it('should be the cell model factory used by the model', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model.contentFactory.codeCellContentFactory).to.equal(
|
|
|
+ expect(model.contentFactory.codeCellContentFactory).toBe(
|
|
|
NotebookModel.defaultContentFactory.codeCellContentFactory
|
|
|
);
|
|
|
});
|
|
@@ -178,21 +179,21 @@ describe('@jupyterlab/notebook', () => {
|
|
|
describe('#nbformat', () => {
|
|
|
it('should get the major version number of the nbformat', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
- expect(model.nbformat).to.equal(NBTestUtils.DEFAULT_CONTENT.nbformat);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ expect(model.nbformat).toBe(utils.DEFAULT_CONTENT.nbformat);
|
|
|
});
|
|
|
|
|
|
it('should present a dialog when the format changes', () => {
|
|
|
const model = new NotebookModel();
|
|
|
const content = {
|
|
|
- ...NBTestUtils.DEFAULT_CONTENT,
|
|
|
+ ...utils.DEFAULT_CONTENT,
|
|
|
metadata: {
|
|
|
- ...NBTestUtils.DEFAULT_CONTENT.metadata,
|
|
|
+ ...utils.DEFAULT_CONTENT.metadata,
|
|
|
orig_nbformat: 1
|
|
|
}
|
|
|
};
|
|
|
model.fromJSON(content);
|
|
|
- expect(model.nbformat).to.equal(nbformat.MAJOR_VERSION);
|
|
|
+ expect(model.nbformat).toBe(nbformat.MAJOR_VERSION);
|
|
|
return acceptDialog();
|
|
|
});
|
|
|
});
|
|
@@ -200,8 +201,8 @@ describe('@jupyterlab/notebook', () => {
|
|
|
describe('#nbformatMinor', () => {
|
|
|
it('should get the minor version number of the nbformat', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
- expect(model.nbformatMinor).to.equal(nbformat.MINOR_VERSION);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ expect(model.nbformatMinor).toBe(nbformat.MINOR_VERSION);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -209,12 +210,12 @@ describe('@jupyterlab/notebook', () => {
|
|
|
it('should get the default kernel name of the document', () => {
|
|
|
const model = new NotebookModel();
|
|
|
model.metadata.set('kernelspec', { name: 'python3' });
|
|
|
- expect(model.defaultKernelName).to.equal('python3');
|
|
|
+ expect(model.defaultKernelName).toBe('python3');
|
|
|
});
|
|
|
|
|
|
it('should default to an empty string', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model.defaultKernelName).to.equal('');
|
|
|
+ expect(model.defaultKernelName).toBe('');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -222,85 +223,85 @@ describe('@jupyterlab/notebook', () => {
|
|
|
it('should get the default kernel language of the document', () => {
|
|
|
const model = new NotebookModel();
|
|
|
model.metadata.set('language_info', { name: 'python' });
|
|
|
- expect(model.defaultKernelLanguage).to.equal('python');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('python');
|
|
|
});
|
|
|
|
|
|
it('should default to an empty string', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model.defaultKernelLanguage).to.equal('');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('');
|
|
|
});
|
|
|
|
|
|
it('should be set from the constructor arg', () => {
|
|
|
const model = new NotebookModel({ languagePreference: 'foo' });
|
|
|
- expect(model.defaultKernelLanguage).to.equal('foo');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#dispose()', () => {
|
|
|
it('should dispose of the resources held by the model', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
model.dispose();
|
|
|
- expect(model.cells).to.be.null;
|
|
|
- expect(model.isDisposed).to.equal(true);
|
|
|
+ expect(model.cells).toBeNull();
|
|
|
+ expect(model.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should be safe to call multiple times', () => {
|
|
|
const model = new NotebookModel();
|
|
|
model.dispose();
|
|
|
model.dispose();
|
|
|
- expect(model.isDisposed).to.equal(true);
|
|
|
+ expect(model.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#toString()', () => {
|
|
|
it('should serialize the model to a string', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
const text = model.toString();
|
|
|
const data = JSON.parse(text);
|
|
|
- expect(data.cells.length).to.equal(6);
|
|
|
+ expect(data.cells.length).toBe(6);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#fromString()', () => {
|
|
|
it('should deserialize the model from a string', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromString(JSON.stringify(NBTestUtils.DEFAULT_CONTENT));
|
|
|
- expect(model.cells.length).to.equal(6);
|
|
|
+ model.fromString(JSON.stringify(utils.DEFAULT_CONTENT));
|
|
|
+ expect(model.cells.length).toBe(6);
|
|
|
});
|
|
|
|
|
|
it('should set the dirty flag', () => {
|
|
|
const model = new NotebookModel();
|
|
|
model.dirty = false;
|
|
|
- model.fromString(JSON.stringify(NBTestUtils.DEFAULT_CONTENT));
|
|
|
- expect(model.dirty).to.equal(true);
|
|
|
+ model.fromString(JSON.stringify(utils.DEFAULT_CONTENT));
|
|
|
+ expect(model.dirty).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#toJSON()', () => {
|
|
|
it('should serialize the model to JSON', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
const data = model.toJSON();
|
|
|
- expect(data.cells.length).to.equal(6);
|
|
|
+ expect(data.cells.length).toBe(6);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#fromJSON()', () => {
|
|
|
it('should serialize the model from JSON', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
- expect(model.cells.length).to.equal(6);
|
|
|
- expect(model.nbformat).to.equal(NBTestUtils.DEFAULT_CONTENT.nbformat);
|
|
|
- expect(model.nbformatMinor).to.equal(nbformat.MINOR_VERSION);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ expect(model.cells.length).toBe(6);
|
|
|
+ expect(model.nbformat).toBe(utils.DEFAULT_CONTENT.nbformat);
|
|
|
+ expect(model.nbformatMinor).toBe(nbformat.MINOR_VERSION);
|
|
|
});
|
|
|
|
|
|
it('should set the dirty flag', () => {
|
|
|
const model = new NotebookModel();
|
|
|
model.dirty = false;
|
|
|
- model.fromJSON(NBTestUtils.DEFAULT_CONTENT);
|
|
|
- expect(model.dirty).to.equal(true);
|
|
|
+ model.fromJSON(utils.DEFAULT_CONTENT);
|
|
|
+ expect(model.dirty).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -310,14 +311,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const metadata = model.metadata;
|
|
|
expect(metadata.has('kernelspec'));
|
|
|
expect(metadata.has('language_info'));
|
|
|
- expect(metadata.size).to.equal(2);
|
|
|
+ expect(metadata.size).toBe(2);
|
|
|
});
|
|
|
|
|
|
it('should set the dirty flag when changed', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model.dirty).to.equal(false);
|
|
|
+ expect(model.dirty).toBe(false);
|
|
|
model.metadata.set('foo', 'bar');
|
|
|
- expect(model.dirty).to.equal(true);
|
|
|
+ expect(model.dirty).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should emit the `contentChanged` signal', () => {
|
|
@@ -327,31 +328,31 @@ describe('@jupyterlab/notebook', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.metadata.set('foo', 'bar');
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should emit the `metadataChanged` signal', () => {
|
|
|
const model = new NotebookModel();
|
|
|
let called = false;
|
|
|
model.metadata.changed.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model.metadata);
|
|
|
- expect(args.key).to.equal('foo');
|
|
|
- expect(args.oldValue).to.be.undefined;
|
|
|
- expect(args.newValue).to.equal('bar');
|
|
|
+ expect(sender).toBe(model.metadata);
|
|
|
+ expect(args.key).toBe('foo');
|
|
|
+ expect(args.oldValue).toBeUndefined();
|
|
|
+ expect(args.newValue).toBe('bar');
|
|
|
called = true;
|
|
|
});
|
|
|
model.metadata.set('foo', 'bar');
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#initialize()', () => {
|
|
|
it('should add one code cell if the model is empty', () => {
|
|
|
const model = new NotebookModel();
|
|
|
- expect(model.cells.length).to.equal(0);
|
|
|
+ expect(model.cells.length).toBe(0);
|
|
|
model.initialize();
|
|
|
- expect(model.cells.length).to.equal(1);
|
|
|
- expect(model.cells.get(0).type).to.equal('code');
|
|
|
+ expect(model.cells.length).toBe(1);
|
|
|
+ expect(model.cells.get(0).type).toBe('code');
|
|
|
});
|
|
|
|
|
|
it('should clear undo state', () => {
|
|
@@ -359,18 +360,18 @@ describe('@jupyterlab/notebook', () => {
|
|
|
const cell = model.contentFactory.createCodeCell({});
|
|
|
cell.value.text = 'foo';
|
|
|
model.cells.push(cell);
|
|
|
- expect(model.cells.canUndo).to.equal(true);
|
|
|
+ expect(model.cells.canUndo).toBe(true);
|
|
|
model.initialize();
|
|
|
- expect(model.cells.canUndo).to.equal(false);
|
|
|
+ expect(model.cells.canUndo).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('.ContentFactory', () => {
|
|
|
let factory = new NotebookModel.ContentFactory({});
|
|
|
|
|
|
- context('#codeCellContentFactory', () => {
|
|
|
+ describe('#codeCellContentFactory', () => {
|
|
|
it('should be a code cell content factory', () => {
|
|
|
- expect(factory.codeCellContentFactory).to.equal(
|
|
|
+ expect(factory.codeCellContentFactory).toBe(
|
|
|
CodeCellModel.defaultContentFactory
|
|
|
);
|
|
|
});
|
|
@@ -380,33 +381,31 @@ describe('@jupyterlab/notebook', () => {
|
|
|
factory = new NotebookModel.ContentFactory({
|
|
|
codeCellContentFactory
|
|
|
});
|
|
|
- expect(factory.codeCellContentFactory).to.equal(
|
|
|
- codeCellContentFactory
|
|
|
- );
|
|
|
+ expect(factory.codeCellContentFactory).toBe(codeCellContentFactory);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- context('#createCell()', () => {
|
|
|
+ describe('#createCell()', () => {
|
|
|
it('should create a new code cell', () => {
|
|
|
const cell = factory.createCell('code', {});
|
|
|
- expect(cell.type).to.equal('code');
|
|
|
+ expect(cell.type).toBe('code');
|
|
|
});
|
|
|
|
|
|
it('should create a new code cell', () => {
|
|
|
const cell = factory.createCell('markdown', {});
|
|
|
- expect(cell.type).to.equal('markdown');
|
|
|
+ expect(cell.type).toBe('markdown');
|
|
|
});
|
|
|
|
|
|
it('should create a new code cell', () => {
|
|
|
const cell = factory.createCell('raw', {});
|
|
|
- expect(cell.type).to.equal('raw');
|
|
|
+ expect(cell.type).toBe('raw');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- context('#createCodeCell()', () => {
|
|
|
+ describe('#createCodeCell()', () => {
|
|
|
it('should create a new code cell', () => {
|
|
|
const cell = factory.createCodeCell({});
|
|
|
- expect(cell.type).to.equal('code');
|
|
|
+ expect(cell.type).toBe('code');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing code cell', () => {
|
|
@@ -414,7 +413,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createCodeCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing raw cell', () => {
|
|
@@ -422,14 +421,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createCodeCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- context('#createRawCell()', () => {
|
|
|
+ describe('#createRawCell()', () => {
|
|
|
it('should create a new raw cell', () => {
|
|
|
const cell = factory.createRawCell({});
|
|
|
- expect(cell.type).to.equal('raw');
|
|
|
+ expect(cell.type).toBe('raw');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing raw cell', () => {
|
|
@@ -437,7 +436,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createRawCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing code cell', () => {
|
|
@@ -445,14 +444,14 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createRawCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#createMarkdownCell()', () => {
|
|
|
it('should create a new markdown cell', () => {
|
|
|
const cell = factory.createMarkdownCell({});
|
|
|
- expect(cell.type).to.equal('markdown');
|
|
|
+ expect(cell.type).toBe('markdown');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing markdown cell', () => {
|
|
@@ -460,7 +459,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createMarkdownCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
|
|
|
it('should clone an existing raw cell', () => {
|
|
@@ -468,13 +467,13 @@ describe('@jupyterlab/notebook', () => {
|
|
|
orig.value.text = 'foo';
|
|
|
const cell = orig.toJSON();
|
|
|
const newCell = factory.createMarkdownCell({ cell });
|
|
|
- expect(newCell.value.text).to.equal('foo');
|
|
|
+ expect(newCell.value.text).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#modelDB', () => {
|
|
|
it('should be undefined by default', () => {
|
|
|
- expect(factory.modelDB).to.be.undefined;
|
|
|
+ expect(factory.modelDB).toBeUndefined();
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -482,11 +481,11 @@ describe('@jupyterlab/notebook', () => {
|
|
|
it('should create a new content factory with a new IModelDB', () => {
|
|
|
const modelDB = new ModelDB();
|
|
|
const factory = new NotebookModel.ContentFactory({ modelDB });
|
|
|
- expect(factory.modelDB).to.equal(modelDB);
|
|
|
+ expect(factory.modelDB).toBe(modelDB);
|
|
|
const newModelDB = new ModelDB();
|
|
|
const newFactory = factory.clone(newModelDB);
|
|
|
- expect(newFactory.modelDB).to.equal(newModelDB);
|
|
|
- expect(newFactory.codeCellContentFactory).to.equal(
|
|
|
+ expect(newFactory.modelDB).toBe(newModelDB);
|
|
|
+ expect(newFactory.codeCellContentFactory).toBe(
|
|
|
factory.codeCellContentFactory
|
|
|
);
|
|
|
});
|
|
@@ -495,7 +494,7 @@ describe('@jupyterlab/notebook', () => {
|
|
|
|
|
|
describe('.defaultContentFactory', () => {
|
|
|
it('should be a ContentFactory', () => {
|
|
|
- expect(NotebookModel.defaultContentFactory).to.be.an.instanceof(
|
|
|
+ expect(NotebookModel.defaultContentFactory).toBeInstanceOf(
|
|
|
NotebookModel.ContentFactory
|
|
|
);
|
|
|
});
|