Преглед на файлове

Modernize notebook tests.

Afshin Darian преди 8 години
родител
ревизия
9392907d2d

+ 57 - 66
test/src/notebook/completion/widget.spec.ts

@@ -5,11 +5,11 @@ import expect = require('expect.js');
 
 import {
   sendMessage, Message
-} from 'phosphor-messaging';
+} from 'phosphor/lib/core/messaging';
 
 import {
-  Widget
-} from 'phosphor-widget';
+  Widget, WidgetMessage
+} from 'phosphor/lib/ui/widget';
 
 import {
   simulate
@@ -17,7 +17,7 @@ import {
 
 import {
   ICompletionRequest, ICoords
-} from '../../../../lib/notebook/cells/editor'
+} from '../../../../lib/notebook/cells/editor';
 
 import {
   CompletionWidget, CompletionModel, ICompletionItem
@@ -68,15 +68,6 @@ describe('notebook/completion/widget', () => {
 
   describe('CompletionWidget', () => {
 
-    describe('.createNode()', () => {
-
-      it('should create node for a completion widget', () => {
-        let node = CompletionWidget.createNode();
-        expect(node.tagName.toLowerCase()).to.be('ul');
-      });
-
-    });
-
     describe('#constructor()', () => {
 
       it('should create a completion widget', () => {
@@ -103,7 +94,7 @@ describe('notebook/completion/widget', () => {
 
         let widget = new CompletionWidget(options);
         expect(widget).to.be.a(CompletionWidget);
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
 
         let items = widget.node.querySelectorAll(`.${ITEM_CLASS}`);
         expect(items).to.have.length(2);
@@ -123,13 +114,13 @@ describe('notebook/completion/widget', () => {
         let value = '';
         let listener = (sender: any, selected: string) => { value = selected; };
         options.model.options = ['foo', 'bar'];
-        anchor.attach(document.body);
+        Widget.attach(anchor, document.body);
 
         let widget = new CompletionWidget(options);
 
         widget.selected.connect(listener);
-        widget.attach(document.body);
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        Widget.attach(widget, document.body);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(value).to.be('');
         simulate(anchor.node, 'keydown', { keyCode: 13 }); // Enter
         expect(value).to.be('foo');
@@ -150,14 +141,14 @@ describe('notebook/completion/widget', () => {
         let called = false;
         let listener = () => { called = true; };
         options.model.options = ['foo', 'bar'];
-        anchor.attach(document.body);
+        Widget.attach(anchor, document.body);
 
         let widget = new CompletionWidget(options);
 
         widget.visibilityChanged.connect(listener);
         expect(called).to.be(false);
-        widget.attach(document.body);
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        Widget.attach(widget, document.body);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(called).to.be(true);
         widget.dispose();
         anchor.dispose();
@@ -247,16 +238,16 @@ describe('notebook/completion/widget', () => {
           model, anchor: anchor.node
         };
         model.options = ['foo', 'bar'];
-        anchor.attach(document.body);
+        Widget.attach(anchor, document.body);
 
         let widget = new CompletionWidget(options);
 
-        widget.attach(document.body);
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        Widget.attach(widget, document.body);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(widget.isHidden).to.be(false);
         expect(model.options).to.be.ok();
         widget.reset();
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(widget.isHidden).to.be(true);
         expect(model.options).to.not.be.ok();
         widget.dispose();
@@ -269,7 +260,7 @@ describe('notebook/completion/widget', () => {
 
       it('should handle document keydown and mousedown events', () => {
         let widget = new LogWidget();
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         ['keydown', 'mousedown'].forEach(type => {
           simulate(document, type);
           expect(widget.events).to.contain(type);
@@ -280,7 +271,7 @@ describe('notebook/completion/widget', () => {
       it('should handle anchor element scroll events', () => {
         let anchor = new Widget();
         let widget = new LogWidget({ anchor: anchor.node });
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         simulate(anchor.node, 'scroll');
         expect(widget.events).to.contain('scroll');
         widget.dispose();
@@ -295,16 +286,16 @@ describe('notebook/completion/widget', () => {
             model, anchor: anchor.node
           };
           model.options = ['foo', 'bar'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(widget.isHidden).to.be(false);
           expect(model.options).to.be.ok();
           simulate(document.body, 'keydown', { keyCode: 70 }); // F
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(widget.isHidden).to.be(true);
           expect(model.options).to.not.be.ok();
           widget.dispose();
@@ -322,13 +313,13 @@ describe('notebook/completion/widget', () => {
             value = selected;
           };
           model.options = ['foo', 'bar', 'baz'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(value).to.be('');
           simulate(anchor.node, 'keydown', { keyCode: 13 }); // Enter
           expect(value).to.be('foo');
@@ -343,14 +334,14 @@ describe('notebook/completion/widget', () => {
             model, anchor: anchor.node
           };
           model.options = ['foo', 'bar', 'baz'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
           let target = document.createElement('div');
 
           anchor.node.appendChild(target);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
 
           let items = widget.node.querySelectorAll(`.${ITEM_CLASS}`);
 
@@ -380,12 +371,12 @@ describe('notebook/completion/widget', () => {
             model, anchor: anchor.node
           };
           model.options = ['foo', 'bar', 'baz'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
 
           let items = widget.node.querySelectorAll(`.${ITEM_CLASS}`);
 
@@ -419,19 +410,19 @@ describe('notebook/completion/widget', () => {
             value = selected;
           };
           model.options = ['foo', 'four', 'foz'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
 
           let marked = widget.node.querySelectorAll(`.${ITEM_CLASS} mark`);
           expect(marked).to.be.empty();
           expect(value).to.be('');
           simulate(anchor.node, 'keydown', { keyCode: 9 });  // Tab
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           marked = widget.node.querySelectorAll(`.${ITEM_CLASS} mark`);
           expect(value).to.be('fo');
           expect(marked).to.have.length(3);
@@ -460,13 +451,13 @@ describe('notebook/completion/widget', () => {
           };
           model.options = ['foo', 'bar', 'baz'];
           model.query = 'b';
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
 
           let item = widget.node.querySelectorAll(`.${ITEM_CLASS} mark`)[1];
 
@@ -488,13 +479,13 @@ describe('notebook/completion/widget', () => {
             value = selected;
           };
           model.options = ['foo', 'bar'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(value).to.be('');
           simulate(widget.node, 'mousedown', { button: 1 });
           expect(value).to.be('');
@@ -513,13 +504,13 @@ describe('notebook/completion/widget', () => {
             value = selected;
           };
           model.options = ['foo', 'bar'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(value).to.be('');
           simulate(widget.node, 'mousedown');
           expect(value).to.be('');
@@ -538,16 +529,16 @@ describe('notebook/completion/widget', () => {
             value = selected;
           };
           model.options = ['foo', 'bar'];
-          anchor.attach(document.body);
+          Widget.attach(anchor, document.body);
 
           let widget = new CompletionWidget(options);
 
           widget.selected.connect(listener);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(widget.isHidden).to.be(false);
           simulate(anchor.node, 'mousedown');
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
           expect(widget.isHidden).to.be(true);
           widget.dispose();
           anchor.dispose();
@@ -577,15 +568,15 @@ describe('notebook/completion/widget', () => {
           anchor.style.height = '1000px';
           anchor.style.overflow = 'auto';
 
-          container.attach(anchor);
+          Widget.attach(container, anchor);
           container.node.style.height = '5000px';
           anchor.scrollTop = 0;
           model.original = request;
           model.options = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
 
           let widget = new CompletionWidget(options);
-          widget.attach(document.body);
-          sendMessage(widget, Widget.MsgUpdateRequest);
+          Widget.attach(widget, document.body);
+          sendMessage(widget, WidgetMessage.UpdateRequest);
 
           let top = parseInt(window.getComputedStyle(widget.node).top, 10);
           let offset = 200;
@@ -624,16 +615,16 @@ describe('notebook/completion/widget', () => {
         let options: CompletionWidget.IOptions = { model, anchor: anchor.node };
         let listener = (sender: any, selected: string) => { value = selected; };
 
-        anchor.attach(document.body);
+        Widget.attach(anchor, document.body);
         model.original = request;
         model.options = ['foo'];
 
         let widget = new CompletionWidget(options);
         widget.selected.connect(listener);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
 
         expect(value).to.be('');
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(value).to.be('foo');
         widget.dispose();
         anchor.dispose();
@@ -641,7 +632,7 @@ describe('notebook/completion/widget', () => {
 
       it('should do nothing if a model does not exist', () => {
         let widget = new LogWidget();
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(widget.methods).to.contain('onUpdateRequest');
       });
 
@@ -659,15 +650,15 @@ describe('notebook/completion/widget', () => {
         };
         let options: CompletionWidget.IOptions = { model, anchor: anchor.node };
 
-        anchor.attach(document.body);
+        Widget.attach(anchor, document.body);
         model.original = request;
         model.options = ['foo', 'bar', 'baz'];
 
         let widget = new CompletionWidget(options);
         widget.hide();
         expect(widget.isHidden).to.be(true);
-        widget.attach(document.body);
-        sendMessage(widget, Widget.MsgUpdateRequest);
+        Widget.attach(widget, document.body);
+        sendMessage(widget, WidgetMessage.UpdateRequest);
         expect(widget.isVisible).to.be(true);
         widget.dispose();
         anchor.dispose();

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

@@ -13,7 +13,7 @@ import {
 
 import {
   MimeData
-} from 'phosphor-dragdrop';
+} from 'phosphor/lib/core/mimedata';
 
 import {
   CodeCellWidget, MarkdownCellWidget, RawCellWidget

+ 19 - 31
test/src/notebook/notebook/default-toolbar.spec.ts

@@ -5,7 +5,11 @@ import expect = require('expect.js');
 
 import {
   MimeData
-} from 'phosphor-dragdrop';
+} from 'phosphor/lib/core/mimedata';
+
+import {
+  Widget
+} from 'phosphor/lib/ui/widget';
 
 import {
  CodeCellWidget, MarkdownCellWidget
@@ -35,10 +39,6 @@ import {
   defaultRenderMime
 } from '../../rendermime/rendermime.spec';
 
-import {
-  acceptDialog
-} from '../../utils';
-
 import {
   DEFAULT_CONTENT
 } from '../utils';
@@ -77,7 +77,7 @@ describe('notebook/notebook/default-toolbar', () => {
 
       it('should save when clicked', () => {
         let button = ToolbarItems.createSaveButton(panel);
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         button.node.click();
         expect(context.methods).to.contain('save');
         button.dispose();
@@ -94,7 +94,7 @@ describe('notebook/notebook/default-toolbar', () => {
 
       it('should insert below when clicked', () => {
         let button = ToolbarItems.createInsertButton(panel);
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         button.node.click();
         expect(panel.content.activeCellIndex).to.be(1);
         expect(panel.content.activeCell).to.be.a(CodeCellWidget);
@@ -113,7 +113,7 @@ describe('notebook/notebook/default-toolbar', () => {
       it('should cut when clicked', () => {
         let button = ToolbarItems.createCutButton(panel);
         let count = panel.content.childCount();
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         button.node.click();
         expect(panel.content.childCount()).to.be(count - 1);
         expect(clipboard.hasData(JUPYTER_CELL_MIME)).to.be(true);
@@ -132,7 +132,7 @@ describe('notebook/notebook/default-toolbar', () => {
       it('should copy when clicked', () => {
         let button = ToolbarItems.createCopyButton(panel);
         let count = panel.content.childCount();
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         button.node.click();
         expect(panel.content.childCount()).to.be(count);
         expect(clipboard.hasData(JUPYTER_CELL_MIME)).to.be(true);
@@ -148,17 +148,20 @@ describe('notebook/notebook/default-toolbar', () => {
 
     describe('#createPasteButton()', () => {
 
-      it('should paste when clicked', () => {
+      it('should paste when clicked', (done) => {
         let button = ToolbarItems.createPasteButton(panel);
         let count = panel.content.childCount();
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         NotebookActions.copy(panel.content, clipboard);
         button.node.click();
-        expect(panel.content.childCount()).to.be(count + 1);
-        button.dispose();
+        requestAnimationFrame(() => {
+          expect(panel.content.childCount()).to.be(count + 1);
+          button.dispose();
+          done();
+        });
       });
 
-      it("should have the `'jp-NBToolbar-paste'` class", () => {
+      it('should have the `\'jp-NBToolbar-paste\'` class', () => {
         let button = ToolbarItems.createPasteButton(panel);
         expect(button.hasClass('jp-NBToolbar-paste')).to.be(true);
       });
@@ -176,7 +179,7 @@ describe('notebook/notebook/default-toolbar', () => {
         let cell = widget.activeCell as CodeCellWidget;
         cell.model.outputs.clear();
         next.rendered = false;
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         panel.kernel.statusChanged.connect((sender, status) => {
           if (status === 'idle') {
             expect(cell.model.outputs.length).to.be.above(0);
@@ -199,7 +202,7 @@ describe('notebook/notebook/default-toolbar', () => {
 
       it('should interrupt the kernel when clicked', (done) => {
         let button = ToolbarItems.createInterruptButton(panel);
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         button.node.click();
         expect(panel.context.kernel.status).to.be('busy');
         panel.kernel.statusChanged.connect((sender, status) => {
@@ -219,21 +222,6 @@ describe('notebook/notebook/default-toolbar', () => {
 
     describe('#createRestartButton()', () => {
 
-      // it('should restart the kernel when the dialog is accepted', (done) => {
-      //   let button = ToolbarItems.createRestartButton(panel);
-      //   panel.attach(document.body);
-      //   button.attach(document.body);
-      //   panel.kernel.statusChanged.connect((sender, status) => {
-      //     if (status === 'restarting') {
-      //       panel.dispose();
-      //       button.dispose();
-      //       done();
-      //     }
-      //   });
-      //   button.node.click();
-      //   acceptDialog(panel.node);
-      // });
-
       it("should have the `'jp-NBToolbar-restart'` class", () => {
         let button = ToolbarItems.createRestartButton(panel);
         expect(button.hasClass('jp-NBToolbar-restart')).to.be(true);

+ 4 - 12
test/src/notebook/notebook/panel.spec.ts

@@ -3,30 +3,22 @@
 
 import expect = require('expect.js');
 
-import {
-  IKernel
-} from 'jupyter-js-services';
-
 import {
   MockKernel
 } from 'jupyter-js-services/lib/mockkernel';
 
 import {
   MimeData
-} from 'phosphor-dragdrop';
+} from 'phosphor/lib/core/mimedata';
 
 import {
   IChangedArgs
-} from 'phosphor-properties';
+} from '../../../../lib/common/interfaces';
 
 import {
   IDocumentContext
 } from '../../../../lib/docregistry';
 
-import {
-  CellEditorWidget, ITextChange, ICompletionRequest
-} from '../../../../lib/notebook/cells/editor';
-
 import {
   CompletionWidget
 } from '../../../../lib/notebook/completion';
@@ -386,12 +378,12 @@ describe('notebook/notebook/panel', () => {
         expect(panel.methods).to.contain('onPathChanged');
       });
 
-      it('should update the title text', () => {
+      it('should update the title label', () => {
         let panel = createPanel();
         panel.methods = [];
         panel.context.saveAs();
         expect(panel.methods).to.contain('onPathChanged');
-        expect(panel.title.text).to.be('foo');
+        expect(panel.title.label).to.be('foo');
       });
 
     });

+ 9 - 18
test/src/notebook/notebook/toolbar.spec.ts

@@ -5,11 +5,11 @@ import expect = require('expect.js');
 
 import {
   Message
-} from 'phosphor-messaging';
+} from 'phosphor/lib/core/messaging';
 
 import {
   Widget
-} from 'phosphor-widget';
+} from 'phosphor/lib/ui/widget';
 
 import {
   simulate
@@ -119,15 +119,6 @@ describe('notebook/notebook/toolbar', () => {
 
   describe('ToolbarButton', () => {
 
-    describe('#createNode()', () => {
-
-      it('should create a node for the toolbar button', () => {
-        let node = ToolbarButton.createNode();
-        expect(node.localName).to.be('span');
-      });
-
-    });
-
     describe('#constructor()', () => {
 
       it('should accept no arguments', () => {
@@ -173,7 +164,7 @@ describe('notebook/notebook/toolbar', () => {
           let button = new ToolbarButton({
             onClick: () => { called = true; },
           });
-          button.attach(document.body);
+          Widget.attach(button, document.body);
           requestAnimationFrame(() => {
             simulate(button.node, 'click');
             expect(called).to.be(true);
@@ -187,7 +178,7 @@ describe('notebook/notebook/toolbar', () => {
 
         it('should add the `jp-mod-pressed` class', (done) => {
           let button = new ToolbarButton();
-          button.attach(document.body);
+          Widget.attach(button, document.body);
           requestAnimationFrame(() => {
             simulate(button.node, 'mousedown');
             expect(button.hasClass('jp-mod-pressed')).to.be(true);
@@ -201,7 +192,7 @@ describe('notebook/notebook/toolbar', () => {
 
         it('should remove the `jp-mod-pressed` class', (done) => {
           let button = new ToolbarButton();
-          button.attach(document.body);
+          Widget.attach(button, document.body);
           requestAnimationFrame(() => {
             simulate(button.node, 'mousedown');
             simulate(button.node, 'mouseup');
@@ -216,7 +207,7 @@ describe('notebook/notebook/toolbar', () => {
 
         it('should remove the `jp-mod-pressed` class', (done) => {
           let button = new ToolbarButton();
-          button.attach(document.body);
+          Widget.attach(button, document.body);
           requestAnimationFrame(() => {
             simulate(button.node, 'mousedown');
             simulate(button.node, 'mouseout');
@@ -233,7 +224,7 @@ describe('notebook/notebook/toolbar', () => {
 
       it('should add event listeners to the node', () => {
         let button = new LogToolbarButton();
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         expect(button.methods).to.contain('onAfterAttach');
         simulate(button.node, 'mousedown');
         simulate(button.node, 'mouseup');
@@ -249,9 +240,9 @@ describe('notebook/notebook/toolbar', () => {
 
       it('should remove event listeners from the node', (done) => {
         let button = new LogToolbarButton();
-        button.attach(document.body);
+        Widget.attach(button, document.body);
         requestAnimationFrame(() => {
-          button.detach();
+          Widget.detach(button);
           expect(button.methods).to.contain('onBeforeDetach');
           simulate(button.node, 'mousedown');
           simulate(button.node, 'mouseup');

+ 13 - 9
test/src/notebook/notebook/widget.spec.ts

@@ -5,11 +5,15 @@ import expect = require('expect.js');
 
 import {
   Message
-} from 'phosphor-messaging';
+} from 'phosphor/lib/core/messaging';
+
+import {
+  Widget
+} from 'phosphor/lib/ui/widget';
 
 import {
   IChangedArgs
-} from 'phosphor-properties';
+} from '../../../../lib/common/interfaces';
 
 import {
   simulate
@@ -665,7 +669,7 @@ describe('notebook/notebook/widget', () => {
       it('should deselect all cells if switching to edit mode', (done) => {
         let widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         requestAnimationFrame(() => {
           for (let i = 0; i < widget.childCount(); i++) {
             let cell = widget.childAt(i);
@@ -842,7 +846,7 @@ describe('notebook/notebook/widget', () => {
       beforeEach((done) => {
         widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         requestAnimationFrame(() => { done(); });
       });
 
@@ -938,7 +942,7 @@ describe('notebook/notebook/widget', () => {
       it('should add event listeners', (done) => {
         let widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         let child = widget.childAt(0);
         requestAnimationFrame(() => {
           expect(widget.methods).to.contain('onAfterAttach');
@@ -956,7 +960,7 @@ describe('notebook/notebook/widget', () => {
       it('should post an update request', (done) => {
         let widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         requestAnimationFrame(() => {
           expect(widget.methods).to.contain('onAfterAttach');
           requestAnimationFrame(() => {
@@ -974,10 +978,10 @@ describe('notebook/notebook/widget', () => {
       it('should remove event listeners', (done) => {
         let widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         let child = widget.childAt(0);
         requestAnimationFrame(() => {
-          widget.detach();
+          Widget.detach(widget);
           expect(widget.methods).to.contain('onBeforeDetach');
           widget.events = [];
           simulate(widget.node, 'click');
@@ -1000,7 +1004,7 @@ describe('notebook/notebook/widget', () => {
       beforeEach((done) => {
         widget = createActiveWidget();
         widget.model.fromJSON(DEFAULT_CONTENT);
-        widget.attach(document.body);
+        Widget.attach(widget, document.body);
         requestAnimationFrame(() => {  done(); });
       });
 

+ 1 - 1
test/src/notebook/notebook/widgetfactory.spec.ts

@@ -5,7 +5,7 @@ import expect = require('expect.js');
 
 import {
   MimeData
-} from 'phosphor-dragdrop';
+} from 'phosphor/lib/core/mimedata';
 
 import {
   NotebookModel

+ 1 - 1
test/src/notebook/output-area/model.spec.ts

@@ -9,7 +9,7 @@ import {
 
 import {
   deepEqual
-} from '../../../../lib/notebook/common/json';
+} from 'phosphor/lib/algorithm/json';
 
 import {
   OutputAreaModel

+ 2 - 2
test/src/notebook/output-area/widget.spec.ts

@@ -5,11 +5,11 @@ import expect = require('expect.js');
 
 import {
   Message
-} from 'phosphor-messaging';
+} from 'phosphor/lib/core/messaging';
 
 import {
   ChildMessage, Widget
-} from 'phosphor-widget';
+} from 'phosphor/lib/ui/widget';
 
 import {
   nbformat