|
@@ -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 { Signal } from '@lumino/signaling';
|
|
|
|
|
@@ -26,17 +25,17 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
describe('#constructor()', () => {
|
|
|
it('should construct a new status bar', () => {
|
|
|
const statusBar = new StatusBar();
|
|
|
- expect(statusBar).to.be.an.instanceof(StatusBar);
|
|
|
+ expect(statusBar).toBeInstanceOf(StatusBar);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#registerStatusItem', () => {
|
|
|
it('should add a new status item to the status bar', () => {
|
|
|
const item = new Widget();
|
|
|
- expect(item.isAttached).to.equal(false);
|
|
|
+ expect(item.isAttached).toBe(false);
|
|
|
statusBar.registerStatusItem('item', { item });
|
|
|
- expect(item.isAttached).to.be.true;
|
|
|
- expect(statusBar.contains(item)).to.be.true;
|
|
|
+ expect(item.isAttached).toBe(true);
|
|
|
+ expect(statusBar.contains(item)).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should raise an error if the same key is added twice', () => {
|
|
@@ -45,7 +44,7 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
statusBar.registerStatusItem('item', { item: item1 });
|
|
|
expect(
|
|
|
statusBar.registerStatusItem.bind(statusBar, 'item', { item: item2 })
|
|
|
- ).to.throw();
|
|
|
+ ).toThrowError();
|
|
|
});
|
|
|
|
|
|
it('should put higher rank left items closer to the middle', () => {
|
|
@@ -61,7 +60,7 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
align: 'left',
|
|
|
rank: 0
|
|
|
});
|
|
|
- expect(item2.node.nextSibling).to.equal(item1.node);
|
|
|
+ expect(item2.node.nextSibling).toBe(item1.node);
|
|
|
});
|
|
|
|
|
|
it('should put higher rank right items closer to the middle', () => {
|
|
@@ -79,7 +78,7 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
});
|
|
|
// Reverse order than what one might expect, as right-to-left
|
|
|
// is set in the styling of the right panel.
|
|
|
- expect(item1.node.nextSibling).to.equal(item2.node);
|
|
|
+ expect(item1.node.nextSibling).toBe(item2.node);
|
|
|
});
|
|
|
|
|
|
it('should allow insertion of status items in the middle', () => {
|
|
@@ -88,7 +87,7 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
item: item,
|
|
|
align: 'middle'
|
|
|
});
|
|
|
- expect(item.isAttached).to.be.true;
|
|
|
+ expect(item.isAttached).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should only show if isActive returns true', () => {
|
|
@@ -97,7 +96,7 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
item,
|
|
|
isActive: () => false
|
|
|
});
|
|
|
- expect(item.isHidden).to.be.true;
|
|
|
+ expect(item.isHidden).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should update whether it is shown if activeStateChanged fires', () => {
|
|
@@ -110,41 +109,41 @@ describe('@jupyterlab/statusbar', () => {
|
|
|
isActive,
|
|
|
activeStateChanged
|
|
|
});
|
|
|
- expect(item.isHidden).to.be.true;
|
|
|
+ expect(item.isHidden).toBe(true);
|
|
|
active = true;
|
|
|
activeStateChanged.emit(void 0);
|
|
|
- expect(item.isHidden).to.be.false;
|
|
|
+ expect(item.isHidden).toBe(false);
|
|
|
});
|
|
|
|
|
|
it('should be removed from the status bar if disposed', () => {
|
|
|
const item = new Widget();
|
|
|
const disposable = statusBar.registerStatusItem('item', { item });
|
|
|
- expect(item.isVisible).to.be.true;
|
|
|
+ expect(item.isVisible).toBe(true);
|
|
|
disposable.dispose();
|
|
|
- expect(item.isVisible).to.be.false;
|
|
|
+ expect(item.isVisible).toBe(false);
|
|
|
});
|
|
|
});
|
|
|
|
|
|
describe('#dispose', () => {
|
|
|
it('should dispose of the status bar', () => {
|
|
|
- expect(statusBar.isDisposed).to.be.false;
|
|
|
+ expect(statusBar.isDisposed).toBe(false);
|
|
|
statusBar.dispose();
|
|
|
- expect(statusBar.isDisposed).to.be.true;
|
|
|
+ expect(statusBar.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should be safe to call more than once', () => {
|
|
|
statusBar.dispose();
|
|
|
- expect(statusBar.isDisposed).to.be.true;
|
|
|
+ expect(statusBar.isDisposed).toBe(true);
|
|
|
statusBar.dispose();
|
|
|
- expect(statusBar.isDisposed).to.be.true;
|
|
|
+ expect(statusBar.isDisposed).toBe(true);
|
|
|
});
|
|
|
|
|
|
it('should dispose of the status items added to it', () => {
|
|
|
const item = new Widget();
|
|
|
statusBar.registerStatusItem('item', { item });
|
|
|
- expect(item.isDisposed).to.be.false;
|
|
|
+ expect(item.isDisposed).toBe(false);
|
|
|
statusBar.dispose();
|
|
|
- expect(item.isDisposed).to.be.true;
|
|
|
+ expect(item.isDisposed).toBe(true);
|
|
|
});
|
|
|
});
|
|
|
});
|