Steven Silvester před 8 roky
rodič
revize
296d289724

+ 3 - 2
test/src/apputils/toolbar.spec.ts

@@ -233,8 +233,9 @@ describe('@jupyterlab/apputils', () => {
       });
 
       it('should handle a starting session', () => {
-        session.dispose();
-        return createClientSession().then(session => {
+        return session.shutdown().then(() => {
+          return createClientSession();
+        }).then(session => {
           let item = Toolbar.createKernelStatusItem(session);
           expect(item.node.title).to.be('Kernel Starting');
           expect(item.hasClass('jp-mod-busy')).to.be(true);

+ 1 - 1
test/src/cells/widget.spec.ts

@@ -392,7 +392,7 @@ describe('cells/widget', () => {
       beforeEach(() => {
         return createClientSession().then(s => {
           session = s;
-          return s.ready;
+          return s.initialize();
         }).then(() => {
           return session.kernel.ready;
         });

+ 1 - 1
test/src/completer/handler.spec.ts

@@ -89,7 +89,7 @@ describe('@jupyterlab/completer', () => {
   before(() => {
     return createClientSession().then(s => {
       session = s;
-      return s.ready;
+      return s.initialize();
     });
   });
 

+ 1 - 1
test/src/console/foreign.spec.ts

@@ -112,7 +112,7 @@ describe('@jupyterlab/console', () => {
         return createClientSession({ path: local.path });
       }).then(s => {
         session = s;
-        return s.ready;
+        return s.initialize();
       });
     });
 

+ 10 - 1
test/src/console/panel.spec.ts

@@ -60,7 +60,6 @@ describe('console/panel', () => {
     panel = new TestPanel({
       manager, contentFactory, rendermime, mimeTypeService
     });
-    return dismissDialog();
   });
 
   afterEach(() => {
@@ -106,6 +105,16 @@ describe('console/panel', () => {
 
     });
 
+    describe('#onAfterAttach()', () => {
+
+      it('should start the session', () => {
+        Widget.attach(panel, document.body);
+        dismissDialog();
+        return panel.session.ready;
+      });
+
+    });
+
     describe('#onActivateRequest()', () => {
 
       it('should give the focus to the console prompt', done => {

+ 7 - 7
test/src/console/widget.spec.ts

@@ -105,7 +105,7 @@ describe('console/widget', () => {
       it('should reflect the contents of the widget', () => {
         let force = true;
         Widget.attach(widget, document.body);
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(widget.cells.length).to.be(1);
@@ -123,7 +123,7 @@ describe('console/widget', () => {
         let force = true;
         Widget.attach(widget, document.body);
         widget.executed.connect((sender, time) => { called = time; });
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(called).to.be.a(Date);
@@ -146,7 +146,7 @@ describe('console/widget', () => {
         let old = widget.prompt;
         expect(old).to.be.a(CodeCellWidget);
 
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(widget.prompt).to.be.a(CodeCellWidget);
@@ -191,7 +191,7 @@ describe('console/widget', () => {
       it('should clear all of the content cells except the banner', () => {
         let force = true;
         Widget.attach(widget, document.body);
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(widget.cells.length).to.be.greaterThan(0);
@@ -228,7 +228,7 @@ describe('console/widget', () => {
         let force = true;
         Widget.attach(widget, document.body);
         expect(widget.cells.length).to.be(0);
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(widget.cells.length).to.be.greaterThan(0);
@@ -241,7 +241,7 @@ 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.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force, timeout);
         }).then(() => {
           expect(widget.cells.length).to.be(0);
@@ -311,7 +311,7 @@ describe('console/widget', () => {
         expect(old).to.be.a(CodeCellWidget);
         widget.methods = [];
 
-        return widget.session.ready.then(() => {
+        return (widget.session as ClientSession).initialize().then(() => {
           return widget.execute(force);
         }).then(() => {
           expect(widget.prompt).to.be.a(CodeCellWidget);

+ 19 - 19
test/src/index.ts

@@ -4,24 +4,24 @@
 import '@phosphor/widgets/style/index.css';
 
 import './apputils/clientsession.spec';
-// import './apputils/toolbar.spec';
-// import './cells/widget.spec';
-// import './completer/handler.spec';
-// import './console/foreign.spec';
-// import './console/history.spec';
-// import './console/panel.spec';
-// import './console/widget.spec';
-// import './coreutils/url.spec';
-// import './docmanager/manager.spec';
+import './apputils/toolbar.spec';
+import './cells/widget.spec';
+import './completer/handler.spec';
+import './console/foreign.spec';
+import './console/history.spec';
+import './console/panel.spec';
+import './console/widget.spec';
+import './coreutils/url.spec';
 
-// import './docmanager/savehandler.spec';
+import './docmanager/manager.spec';
+import './docmanager/savehandler.spec';
 
-// import './docregistry/context.spec';
-// import './docregistry/registry.spec';
-// import './notebook/actions.spec';
-// import './notebook/celltools.spec';
-// import './notebook/default-toolbar.spec';
-// import './notebook/panel.spec';
-// import './notebook/widgetfactory.spec';
-// import './notebook/tracker.spec';
-// import './outputarea/widget.spec';
+import './docregistry/context.spec';
+import './docregistry/registry.spec';
+import './notebook/actions.spec';
+import './notebook/celltools.spec';
+import './notebook/default-toolbar.spec';
+import './notebook/panel.spec';
+import './notebook/widgetfactory.spec';
+import './notebook/tracker.spec';
+import './outputarea/widget.spec';

+ 3 - 3
test/src/notebook/actions.spec.ts

@@ -467,7 +467,7 @@ describe('@jupyterlab/notebook', () => {
     describe('#run()', () => {
 
       beforeEach(() => {
-        return session.ready;
+        return session.initialize();
       });
 
       it('should run the selected cells', function (done) {
@@ -655,7 +655,7 @@ describe('@jupyterlab/notebook', () => {
     describe('#runAndInsert()', () => {
 
       beforeEach(() => {
-        return session.ready;
+        return session.initialize();
       });
 
       it('should run the selected cells ', (done) => {
@@ -743,7 +743,7 @@ describe('@jupyterlab/notebook', () => {
         // Make sure all cells have valid code.
         widget.widgets[2].model.value.text = 'a = 1';
 
-        return session.ready;
+        return session.initialize();
       });
 
       it('should run all of the cells in the notebok', (done) => {

+ 1 - 1
test/src/outputarea/widget.spec.ts

@@ -180,7 +180,7 @@ describe('outputarea/widget', () => {
       beforeEach(() => {
         return createClientSession().then(s => {
           session = s;
-          return session.ready;
+          return session.initialize();
         });
       });