Browse Source

work in progress

A. Darian 8 years ago
parent
commit
5cbb87a29c
1 changed files with 39 additions and 1 deletions
  1. 39 1
      test/src/notebook/cells/widget.spec.ts

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

@@ -27,7 +27,7 @@ import {
 
 import {
   BaseCellWidget, CellModel, InputAreaWidget, ICellModel,
-  CodeCellWidget, CodeCellModel
+  CodeCellWidget, CodeCellModel, ICodeCellModel
 } from '../../../../lib/notebook/cells';
 
 import {
@@ -439,6 +439,44 @@ describe('notebook/cells', () => {
 
     });
 
+    describe('#dispose()', () => {
+
+      it('should dispose of the resources held by the widget', () => {
+        let widget = new CodeCellWidget({ rendermime });
+        widget.dispose();
+        expect(widget.isDisposed).to.be(true);
+      });
+
+      it('should be safe to call multiple times', () => {
+        let widget = new CodeCellWidget({ rendermime });
+        widget.dispose();
+        widget.dispose();
+        expect(widget.isDisposed).to.be(true);
+      });
+
+    });
+
+    describe('#execute()', () => {
+
+      it('should change the execute count of the model', (done) => {
+        let widget = new CodeCellWidget({ rendermime });
+
+        widget.model = new CodeCellModel();
+        widget.model.source = '1 + 1';
+        expect((widget.model as ICodeCellModel).executionCount).to.be(null);
+        widget.execute(new MockKernel()).then(() => {
+          let model = widget.model as ICodeCellModel;
+          expect(model.executionCount).to.not.be(null);
+          done();
+        }).catch((reason: any) => {
+          console.log('oops:', reason);
+          done();
+        });
+
+      });
+
+    });
+
     describe('.Renderer', () => {
 
       describe('#constructor()', () => {