|
@@ -12,15 +12,11 @@ import {
|
|
|
} from '@phosphor/widgets';
|
|
|
|
|
|
import {
|
|
|
- CodeConsole
|
|
|
-} from '@jupyterlab/console';
|
|
|
-
|
|
|
-import {
|
|
|
- ConsoleHistory
|
|
|
-} from '@jupyterlab/console';
|
|
|
+ ClientSession
|
|
|
+} from '@jupyterlab/apputils';
|
|
|
|
|
|
import {
|
|
|
- ForeignHandler
|
|
|
+ CodeConsole, ConsoleHistory, ForeignHandler
|
|
|
} from '@jupyterlab/console';
|
|
|
|
|
|
import {
|
|
@@ -109,7 +105,9 @@ describe('console/widget', () => {
|
|
|
it('should reflect the contents of the widget', () => {
|
|
|
let force = true;
|
|
|
Widget.attach(widget, document.body);
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.cells.length).to.be(1);
|
|
|
widget.clear();
|
|
|
expect(widget.cells.length).to.be(0);
|
|
@@ -125,7 +123,9 @@ describe('console/widget', () => {
|
|
|
let force = true;
|
|
|
Widget.attach(widget, document.body);
|
|
|
widget.executed.connect((sender, time) => { called = time; });
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(called).to.be.a(Date);
|
|
|
});
|
|
|
});
|
|
@@ -146,7 +146,9 @@ describe('console/widget', () => {
|
|
|
let old = widget.prompt;
|
|
|
expect(old).to.be.a(CodeCellWidget);
|
|
|
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.prompt).to.be.a(CodeCellWidget);
|
|
|
expect(widget.prompt).to.not.be(old);
|
|
|
});
|
|
@@ -189,7 +191,9 @@ describe('console/widget', () => {
|
|
|
it('should clear all of the content cells except the banner', () => {
|
|
|
let force = true;
|
|
|
Widget.attach(widget, document.body);
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.cells.length).to.be.greaterThan(0);
|
|
|
widget.clear();
|
|
|
expect(widget.cells.length).to.be(0);
|
|
@@ -224,7 +228,9 @@ describe('console/widget', () => {
|
|
|
let force = true;
|
|
|
Widget.attach(widget, document.body);
|
|
|
expect(widget.cells.length).to.be(0);
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.cells.length).to.be.greaterThan(0);
|
|
|
});
|
|
|
});
|
|
@@ -235,7 +241,9 @@ describe('console/widget', () => {
|
|
|
Widget.attach(widget, document.body);
|
|
|
widget.prompt.model.value.text = 'for x in range(5):';
|
|
|
expect(widget.cells.length).to.be(0);
|
|
|
- return widget.execute(force, timeout).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force, timeout);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.cells.length).to.be(0);
|
|
|
});
|
|
|
});
|
|
@@ -303,7 +311,9 @@ describe('console/widget', () => {
|
|
|
expect(old).to.be.a(CodeCellWidget);
|
|
|
widget.methods = [];
|
|
|
|
|
|
- return widget.execute(force).then(() => {
|
|
|
+ return (widget.session as ClientSession).initialize().then(() => {
|
|
|
+ return widget.execute(force);
|
|
|
+ }).then(() => {
|
|
|
expect(widget.prompt).to.be.a(CodeCellWidget);
|
|
|
expect(widget.prompt).to.not.be(old);
|
|
|
expect(widget.methods).to.contain('newPrompt');
|