|
@@ -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 { toArray } from '@lumino/algorithm';
|
|
|
|
|
@@ -24,6 +23,8 @@ import { ServiceManager } from '@jupyterlab/services';
|
|
|
|
|
|
import { createFileContext, sleep } from '@jupyterlab/testutils';
|
|
|
|
|
|
+import * as Mock from '@jupyterlab/testutils/lib/mock';
|
|
|
+
|
|
|
class WidgetFactory extends ABCWidgetFactory<IDocumentWidget> {
|
|
|
protected createNewWidget(
|
|
|
context: DocumentRegistry.Context
|
|
@@ -50,7 +51,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.fileTypes).to.deep.equal(['text']);
|
|
|
+ expect(factory.fileTypes).toEqual(['text']);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -60,7 +61,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.name).to.equal('test');
|
|
|
+ expect(factory.name).toBe('test');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -70,7 +71,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.defaultFor).to.deep.equal([]);
|
|
|
+ expect(factory.defaultFor).toEqual([]);
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -79,7 +80,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
defaultFor: ['text']
|
|
|
});
|
|
|
- expect(factory.defaultFor).to.deep.equal(['text']);
|
|
|
+ expect(factory.defaultFor).toEqual(['text']);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -89,7 +90,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.defaultRendered).to.deep.equal([]);
|
|
|
+ expect(factory.defaultRendered).toEqual([]);
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -98,7 +99,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
defaultRendered: ['text']
|
|
|
});
|
|
|
- expect(factory.defaultRendered).to.deep.equal(['text']);
|
|
|
+ expect(factory.defaultRendered).toEqual(['text']);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -108,7 +109,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.readOnly).to.equal(false);
|
|
|
+ expect(factory.readOnly).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -117,7 +118,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
readOnly: true
|
|
|
});
|
|
|
- expect(factory.readOnly).to.equal(true);
|
|
|
+ expect(factory.readOnly).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -127,7 +128,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.modelName).to.equal('text');
|
|
|
+ expect(factory.modelName).toBe('text');
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -136,7 +137,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
modelName: 'notebook'
|
|
|
});
|
|
|
- expect(factory.modelName).to.equal('notebook');
|
|
|
+ expect(factory.modelName).toBe('notebook');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -146,7 +147,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.preferKernel).to.equal(false);
|
|
|
+ expect(factory.preferKernel).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -155,7 +156,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
preferKernel: true
|
|
|
});
|
|
|
- expect(factory.preferKernel).to.equal(true);
|
|
|
+ expect(factory.preferKernel).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -165,7 +166,7 @@ describe('docregistry/default', () => {
|
|
|
name: 'test',
|
|
|
fileTypes: ['text']
|
|
|
});
|
|
|
- expect(factory.canStartKernel).to.equal(false);
|
|
|
+ expect(factory.canStartKernel).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should be the value passed in', () => {
|
|
@@ -174,7 +175,7 @@ describe('docregistry/default', () => {
|
|
|
fileTypes: ['text'],
|
|
|
canStartKernel: true
|
|
|
});
|
|
|
- expect(factory.canStartKernel).to.equal(true);
|
|
|
+ expect(factory.canStartKernel).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should have toolbar items', () => {
|
|
@@ -195,19 +196,19 @@ describe('docregistry/default', () => {
|
|
|
const context = createFileContext();
|
|
|
const widget = factory.createNew(context);
|
|
|
const widget2 = factory.createNew(context);
|
|
|
- expect(toArray(widget.toolbar.names())).to.deep.equal(['foo', 'bar']);
|
|
|
- expect(toArray(widget2.toolbar.names())).to.deep.equal(['foo', 'bar']);
|
|
|
- expect(toArray(widget.toolbar.children()).length).to.equal(2);
|
|
|
- expect(toArray(widget2.toolbar.children()).length).to.equal(2);
|
|
|
+ expect(toArray(widget.toolbar.names())).toEqual(['foo', 'bar']);
|
|
|
+ expect(toArray(widget2.toolbar.names())).toEqual(['foo', 'bar']);
|
|
|
+ expect(toArray(widget.toolbar.children()).length).toBe(2);
|
|
|
+ expect(toArray(widget2.toolbar.children()).length).toBe(2);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#isDisposed', () => {
|
|
|
it('should get whether the factory has been disposed', () => {
|
|
|
const factory = createFactory();
|
|
|
- expect(factory.isDisposed).to.equal(false);
|
|
|
+ expect(factory.isDisposed).toBe(false);
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -215,14 +216,14 @@ describe('docregistry/default', () => {
|
|
|
it('should dispose of the resources held by the factory', () => {
|
|
|
const factory = createFactory();
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should be safe to call multiple times', () => {
|
|
|
const factory = createFactory();
|
|
|
factory.dispose();
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -231,7 +232,7 @@ describe('docregistry/default', () => {
|
|
|
const factory = createFactory();
|
|
|
const context = createFileContext();
|
|
|
const widget = factory.createNew(context);
|
|
|
- expect(widget).to.be.an.instanceof(Widget);
|
|
|
+ expect(widget).toBeInstanceOf(Widget);
|
|
|
});
|
|
|
|
|
|
it('should take an optional source widget for cloning', () => {
|
|
@@ -242,9 +243,9 @@ describe('docregistry/default', () => {
|
|
|
context,
|
|
|
widget
|
|
|
);
|
|
|
- expect(clonedWidget).to.not.equal(widget);
|
|
|
- expect(clonedWidget.hasClass('WidgetFactory')).to.be.true;
|
|
|
- expect(clonedWidget.context).to.equal(widget.context);
|
|
|
+ expect(clonedWidget).not.toBe(widget);
|
|
|
+ expect(clonedWidget.hasClass('WidgetFactory')).toBe(true);
|
|
|
+ expect(clonedWidget.context).toBe(widget.context);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -253,21 +254,21 @@ describe('docregistry/default', () => {
|
|
|
describe('#name', () => {
|
|
|
it('should get the name of the model type', () => {
|
|
|
const factory = new Base64ModelFactory();
|
|
|
- expect(factory.name).to.equal('base64');
|
|
|
+ expect(factory.name).toBe('base64');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#contentType', () => {
|
|
|
it('should get the file type', () => {
|
|
|
const factory = new Base64ModelFactory();
|
|
|
- expect(factory.contentType).to.equal('file');
|
|
|
+ expect(factory.contentType).toBe('file');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#fileFormat', () => {
|
|
|
it('should get the file format', () => {
|
|
|
const factory = new Base64ModelFactory();
|
|
|
- expect(factory.fileFormat).to.equal('base64');
|
|
|
+ expect(factory.fileFormat).toBe('base64');
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -276,21 +277,21 @@ describe('docregistry/default', () => {
|
|
|
describe('#constructor()', () => {
|
|
|
it('should create a new document model', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model).to.be.an.instanceof(DocumentModel);
|
|
|
+ expect(model).toBeInstanceOf(DocumentModel);
|
|
|
});
|
|
|
|
|
|
it('should accept an optional language preference', () => {
|
|
|
const model = new DocumentModel('foo');
|
|
|
- expect(model.defaultKernelLanguage).to.equal('foo');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#isDisposed', () => {
|
|
|
it('should get whether the model has been disposed', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model.isDisposed).to.equal(false);
|
|
|
+ expect(model.isDisposed).toBe(false);
|
|
|
model.dispose();
|
|
|
- expect(model.isDisposed).to.equal(true);
|
|
|
+ expect(model.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -299,12 +300,12 @@ describe('docregistry/default', () => {
|
|
|
const model = new DocumentModel();
|
|
|
let called = false;
|
|
|
model.contentChanged.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model);
|
|
|
- expect(args).to.be.undefined;
|
|
|
+ expect(sender).toBe(model);
|
|
|
+ expect(args).toBeUndefined();
|
|
|
called = true;
|
|
|
});
|
|
|
model.fromString('foo');
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should not be emitted if the content does not change', () => {
|
|
@@ -314,7 +315,7 @@ describe('docregistry/default', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.fromString('');
|
|
|
- expect(called).to.equal(false);
|
|
|
+ expect(called).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -323,14 +324,14 @@ describe('docregistry/default', () => {
|
|
|
const model = new DocumentModel();
|
|
|
let called = false;
|
|
|
model.stateChanged.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model);
|
|
|
- expect(args.name).to.equal('readOnly');
|
|
|
- expect(args.oldValue).to.equal(false);
|
|
|
- expect(args.newValue).to.equal(true);
|
|
|
+ expect(sender).toBe(model);
|
|
|
+ expect(args.name).toBe('readOnly');
|
|
|
+ expect(args.oldValue).toBe(false);
|
|
|
+ expect(args.newValue).toBe(true);
|
|
|
called = true;
|
|
|
});
|
|
|
model.readOnly = true;
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should not be emitted if the state does not change', () => {
|
|
@@ -340,28 +341,28 @@ describe('docregistry/default', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.dirty = false;
|
|
|
- expect(called).to.equal(false);
|
|
|
+ expect(called).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#dirty', () => {
|
|
|
it('should get the dirty state of the document', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model.dirty).to.equal(false);
|
|
|
+ expect(model.dirty).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should emit `stateChanged` when changed', () => {
|
|
|
const model = new DocumentModel();
|
|
|
let called = false;
|
|
|
model.stateChanged.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model);
|
|
|
- expect(args.name).to.equal('dirty');
|
|
|
- expect(args.oldValue).to.equal(false);
|
|
|
- expect(args.newValue).to.equal(true);
|
|
|
+ expect(sender).toBe(model);
|
|
|
+ expect(args.name).toBe('dirty');
|
|
|
+ expect(args.oldValue).toBe(false);
|
|
|
+ expect(args.newValue).toBe(true);
|
|
|
called = true;
|
|
|
});
|
|
|
model.dirty = true;
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should not emit `stateChanged` when not changed', () => {
|
|
@@ -371,28 +372,28 @@ describe('docregistry/default', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.dirty = false;
|
|
|
- expect(called).to.equal(false);
|
|
|
+ expect(called).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#readOnly', () => {
|
|
|
it('should get the read only state of the document', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model.readOnly).to.equal(false);
|
|
|
+ expect(model.readOnly).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should emit `stateChanged` when changed', () => {
|
|
|
const model = new DocumentModel();
|
|
|
let called = false;
|
|
|
model.stateChanged.connect((sender, args) => {
|
|
|
- expect(sender).to.equal(model);
|
|
|
- expect(args.name).to.equal('readOnly');
|
|
|
- expect(args.oldValue).to.equal(false);
|
|
|
- expect(args.newValue).to.equal(true);
|
|
|
+ expect(sender).toBe(model);
|
|
|
+ expect(args.name).toBe('readOnly');
|
|
|
+ expect(args.oldValue).toBe(false);
|
|
|
+ expect(args.newValue).toBe(true);
|
|
|
called = true;
|
|
|
});
|
|
|
model.readOnly = true;
|
|
|
- expect(called).to.equal(true);
|
|
|
+ expect(called).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should not emit `stateChanged` when not changed', () => {
|
|
@@ -402,26 +403,26 @@ describe('docregistry/default', () => {
|
|
|
called = true;
|
|
|
});
|
|
|
model.readOnly = false;
|
|
|
- expect(called).to.equal(false);
|
|
|
+ expect(called).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#defaultKernelName', () => {
|
|
|
it('should get the default kernel name of the document', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model.defaultKernelName).to.equal('');
|
|
|
+ expect(model.defaultKernelName).toBe('');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('defaultKernelLanguage', () => {
|
|
|
it('should get the default kernel language of the document', () => {
|
|
|
const model = new DocumentModel();
|
|
|
- expect(model.defaultKernelLanguage).to.equal('');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('');
|
|
|
});
|
|
|
|
|
|
it('should be set by the constructor arg', () => {
|
|
|
const model = new DocumentModel('foo');
|
|
|
- expect(model.defaultKernelLanguage).to.equal('foo');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -429,21 +430,21 @@ describe('docregistry/default', () => {
|
|
|
it('should dispose of the resources held by the document manager', () => {
|
|
|
const model = new DocumentModel();
|
|
|
model.dispose();
|
|
|
- expect(model.isDisposed).to.equal(true);
|
|
|
+ expect(model.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should be safe to call more than once', () => {
|
|
|
const model = new DocumentModel();
|
|
|
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 DocumentModel();
|
|
|
- expect(model.toString()).to.equal('');
|
|
|
+ expect(model.toString()).toBe('');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -451,7 +452,7 @@ describe('docregistry/default', () => {
|
|
|
it('should deserialize the model from a string', () => {
|
|
|
const model = new DocumentModel();
|
|
|
model.fromString('foo');
|
|
|
- expect(model.toString()).to.equal('foo');
|
|
|
+ expect(model.toString()).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -460,7 +461,7 @@ describe('docregistry/default', () => {
|
|
|
const model = new DocumentModel();
|
|
|
const data = { foo: 1 };
|
|
|
model.fromJSON(data);
|
|
|
- expect(model.toJSON()).to.deep.equal(data);
|
|
|
+ expect(model.toJSON()).toEqual(data);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -469,7 +470,7 @@ describe('docregistry/default', () => {
|
|
|
const model = new DocumentModel();
|
|
|
const data: null = null;
|
|
|
model.fromJSON(data);
|
|
|
- expect(model.toString()).to.equal('null');
|
|
|
+ expect(model.toString()).toBe('null');
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -478,30 +479,30 @@ describe('docregistry/default', () => {
|
|
|
describe('#name', () => {
|
|
|
it('should get the name of the model type', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
- expect(factory.name).to.equal('text');
|
|
|
+ expect(factory.name).toBe('text');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#contentType', () => {
|
|
|
it('should get the file type', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
- expect(factory.contentType).to.equal('file');
|
|
|
+ expect(factory.contentType).toBe('file');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#fileFormat', () => {
|
|
|
it('should get the file format', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
- expect(factory.fileFormat).to.equal('text');
|
|
|
+ expect(factory.fileFormat).toBe('text');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#isDisposed', () => {
|
|
|
it('should get whether the factory is disposed', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
- expect(factory.isDisposed).to.equal(false);
|
|
|
+ expect(factory.isDisposed).toBe(false);
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -509,14 +510,14 @@ describe('docregistry/default', () => {
|
|
|
it('should dispose of the resources held by the factory', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should be safe to call multiple times', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
factory.dispose();
|
|
|
factory.dispose();
|
|
|
- expect(factory.isDisposed).to.equal(true);
|
|
|
+ expect(factory.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -524,21 +525,21 @@ describe('docregistry/default', () => {
|
|
|
it('should create a new model', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
const model = factory.createNew();
|
|
|
- expect(model).to.be.an.instanceof(DocumentModel);
|
|
|
+ expect(model).toBeInstanceOf(DocumentModel);
|
|
|
});
|
|
|
|
|
|
it('should accept a language preference', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
const model = factory.createNew('foo');
|
|
|
- expect(model.defaultKernelLanguage).to.equal('foo');
|
|
|
+ expect(model.defaultKernelLanguage).toBe('foo');
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#preferredLanguage()', () => {
|
|
|
it('should get the preferred kernel language given an extension', () => {
|
|
|
const factory = new TextModelFactory();
|
|
|
- expect(factory.preferredLanguage('.py')).to.equal('python');
|
|
|
- expect(factory.preferredLanguage('.jl')).to.equal('julia');
|
|
|
+ expect(factory.preferredLanguage('.py')).toBe('python');
|
|
|
+ expect(factory.preferredLanguage('.jl')).toBe('julia');
|
|
|
});
|
|
|
});
|
|
|
});
|
|
@@ -557,7 +558,7 @@ describe('docregistry/default', () => {
|
|
|
};
|
|
|
|
|
|
beforeAll(async () => {
|
|
|
- manager = new ServiceManager({ standby: 'never' });
|
|
|
+ manager = new Mock.ServiceManagerMock();
|
|
|
await manager.ready;
|
|
|
});
|
|
|
|
|
@@ -565,25 +566,25 @@ describe('docregistry/default', () => {
|
|
|
beforeEach(setup);
|
|
|
|
|
|
it('should set the title for the path', () => {
|
|
|
- expect(widget.title.label).to.equal(context.localPath);
|
|
|
+ expect(widget.title.label).toBe(context.localPath);
|
|
|
});
|
|
|
|
|
|
it('should update the title when the path changes', async () => {
|
|
|
const path = UUID.uuid4() + '.jl';
|
|
|
await context.initialize(true);
|
|
|
await manager.contents.rename(context.path, path);
|
|
|
- expect(widget.title.label).to.equal(path);
|
|
|
+ expect(widget.title.label).toBe(path);
|
|
|
});
|
|
|
|
|
|
it('should add the dirty class when the model is dirty', async () => {
|
|
|
await context.initialize(true);
|
|
|
await context.ready;
|
|
|
context.model.fromString('bar');
|
|
|
- expect(widget.title.className).to.contain('jp-mod-dirty');
|
|
|
+ expect(widget.title.className).toContain('jp-mod-dirty');
|
|
|
});
|
|
|
|
|
|
it('should store the context', () => {
|
|
|
- expect(widget.context).to.equal(context);
|
|
|
+ expect(widget.context).toBe(context);
|
|
|
});
|
|
|
});
|
|
|
|
|
@@ -595,17 +596,18 @@ describe('docregistry/default', () => {
|
|
|
const reveal = sleep(300, x);
|
|
|
const contextReady = Promise.all([context.ready, x]);
|
|
|
const widget = new DocumentWidget({ context, content, reveal });
|
|
|
- expect(widget.isRevealed).to.equal(false);
|
|
|
+ expect(widget.isRevealed).toBe(false);
|
|
|
|
|
|
// Our promise should resolve before the widget reveal promise.
|
|
|
- expect(await Promise.race([widget.revealed, reveal])).to.equal(x);
|
|
|
+ expect(await Promise.race([widget.revealed, reveal])).toBe(x);
|
|
|
// The context ready promise should also resolve first.
|
|
|
void context.initialize(true);
|
|
|
- expect(
|
|
|
- await Promise.race([widget.revealed, contextReady])
|
|
|
- ).to.deep.equal([undefined, x]);
|
|
|
+ expect(await Promise.race([widget.revealed, contextReady])).toEqual([
|
|
|
+ undefined,
|
|
|
+ x
|
|
|
+ ]);
|
|
|
// The widget.revealed promise should finally resolve.
|
|
|
- expect(await widget.revealed).to.be.undefined;
|
|
|
+ expect(await widget.revealed).toBeUndefined();
|
|
|
});
|
|
|
});
|
|
|
});
|