Browse Source

Update console history tests.

Afshin Darian 8 years ago
parent
commit
f4ca706395
2 changed files with 70 additions and 29 deletions
  1. 41 0
      test/src/console/history.spec.ts
  2. 29 29
      test/src/index.ts

+ 41 - 0
test/src/console/history.spec.ts

@@ -148,6 +148,47 @@ describe('console/history', () => {
 
     });
 
+    describe('#forward()', () => {
+
+      it('should return void promise if no forward history exists', (done) => {
+        let history = new ConsoleHistory();
+        history.forward().then(result => {
+          expect(result).to.be(void 0);
+          done();
+        });
+      });
+
+      it('should return next items if they exist', (done) => {
+        let history = new TestHistory({
+          kernel: new MockKernel({ name: 'python' })
+        });
+        history.onHistory(mockHistory);
+        Promise.all([history.back(), history.back()]).then(() => {
+          history.forward().then(result => {
+            let index = mockHistory.content.history.length - 1;
+            let last = (mockHistory.content.history[index] as any)[2];
+            expect(result).to.be(last);
+            done();
+          });
+        });
+      });
+
+    });
+
+    describe('#push()', () => {
+
+      it('should allow addition of history items', (done) => {
+        let history = new ConsoleHistory();
+        let item = 'foo';
+        history.push(item);
+        history.back().then(result => {
+          expect(result).to.be(item);
+          done();
+        });
+      });
+
+    });
+
   });
 
 });

+ 29 - 29
test/src/index.ts

@@ -1,45 +1,45 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
 
-// import './common/activitymonitor.spec';
-// import './common/observablelist.spec';
+import './common/activitymonitor.spec';
+import './common/observablelist.spec';
 
 import './console/history.spec';
 
-// import './dialog/dialog.spec';
+import './dialog/dialog.spec';
 
-// import './docregistry/default.spec';
-// import './docregistry/registry.spec';
+import './docregistry/default.spec';
+import './docregistry/registry.spec';
 
-// import './filebrowser/model.spec';
+import './filebrowser/model.spec';
 
-// import './markdownwidget/widget.spec';
+import './markdownwidget/widget.spec';
 
-// import './renderers/renderers.spec';
-// import './renderers/latex.spec';
+import './renderers/renderers.spec';
+import './renderers/latex.spec';
 
-// import './rendermime/rendermime.spec';
+import './rendermime/rendermime.spec';
 
-// import './notebook/cells/editor.spec';
-// import './notebook/cells/model.spec';
-// import './notebook/cells/widget.spec';
+import './notebook/cells/editor.spec';
+import './notebook/cells/model.spec';
+import './notebook/cells/widget.spec';
 
-// import './notebook/completion/handler.spec';
-// import './notebook/completion/model.spec';
-// import './notebook/completion/widget.spec';
+import './notebook/completion/handler.spec';
+import './notebook/completion/model.spec';
+import './notebook/completion/widget.spec';
 
-// import './notebook/notebook/actions.spec';
-// import './notebook/notebook/default-toolbar.spec';
-// import './notebook/notebook/model.spec';
-// import './notebook/notebook/modelfactory.spec';
-// import './notebook/notebook/nbformat.spec';
-// import './notebook/notebook/panel.spec';
-// import './notebook/notebook/toolbar.spec';
-// import './notebook/notebook/trust.spec';
-// import './notebook/notebook/widget.spec';
-// import './notebook/notebook/widgetfactory.spec';
+import './notebook/notebook/actions.spec';
+import './notebook/notebook/default-toolbar.spec';
+import './notebook/notebook/model.spec';
+import './notebook/notebook/modelfactory.spec';
+import './notebook/notebook/nbformat.spec';
+import './notebook/notebook/panel.spec';
+import './notebook/notebook/toolbar.spec';
+import './notebook/notebook/trust.spec';
+import './notebook/notebook/widget.spec';
+import './notebook/notebook/widgetfactory.spec';
 
-// import './notebook/output-area/model.spec';
-// import './notebook/output-area/widget.spec';
+import './notebook/output-area/model.spec';
+import './notebook/output-area/widget.spec';
 
-// import 'phosphor/styles/base.css';
+import 'phosphor/styles/base.css';