|
@@ -9,15 +9,11 @@ import {
|
|
|
|
|
|
import {
|
|
import {
|
|
Message, sendMessage
|
|
Message, sendMessage
|
|
-} from 'phosphor-messaging';
|
|
|
|
|
|
+} from 'phosphor/lib/core/messaging';
|
|
|
|
|
|
import {
|
|
import {
|
|
- IChangedArgs
|
|
|
|
-} from 'phosphor-properties';
|
|
|
|
-
|
|
|
|
-import {
|
|
|
|
- Widget
|
|
|
|
-} from 'phosphor-widget';
|
|
|
|
|
|
+ Widget, WidgetMessage
|
|
|
|
+} from 'phosphor/lib/ui/widget';
|
|
|
|
|
|
import {
|
|
import {
|
|
RenderMime
|
|
RenderMime
|
|
@@ -66,7 +62,7 @@ class LogBaseCell extends BaseCellWidget {
|
|
this.methods.push('onUpdateRequest');
|
|
this.methods.push('onUpdateRequest');
|
|
}
|
|
}
|
|
|
|
|
|
- protected onMetadataChanged(model: ICellModel, args: IChangedArgs<any>): void {
|
|
|
|
|
|
+ protected onMetadataChanged(model: ICellModel, args: any): void {
|
|
super.onMetadataChanged(model, args);
|
|
super.onMetadataChanged(model, args);
|
|
this.methods.push('onMetadataChanged');
|
|
this.methods.push('onMetadataChanged');
|
|
}
|
|
}
|
|
@@ -76,7 +72,7 @@ class LogBaseCell extends BaseCellWidget {
|
|
this.methods.push('onModelChanged');
|
|
this.methods.push('onModelChanged');
|
|
}
|
|
}
|
|
|
|
|
|
- protected onModelStateChanged(model: ICellModel, args: IChangedArgs<any>): void {
|
|
|
|
|
|
+ protected onModelStateChanged(model: ICellModel, args: any): void {
|
|
super.onModelStateChanged(model, args);
|
|
super.onModelStateChanged(model, args);
|
|
this.methods.push('onModelStateChanged');
|
|
this.methods.push('onModelStateChanged');
|
|
}
|
|
}
|
|
@@ -92,7 +88,7 @@ class LogCodeCell extends CodeCellWidget {
|
|
this.methods.push('onUpdateRequest');
|
|
this.methods.push('onUpdateRequest');
|
|
}
|
|
}
|
|
|
|
|
|
- protected onMetadataChanged(model: ICellModel, args: IChangedArgs<any>): void {
|
|
|
|
|
|
+ protected onMetadataChanged(model: ICellModel, args: any): void {
|
|
super.onMetadataChanged(model, args);
|
|
super.onMetadataChanged(model, args);
|
|
this.methods.push('onMetadataChanged');
|
|
this.methods.push('onMetadataChanged');
|
|
}
|
|
}
|
|
@@ -102,7 +98,7 @@ class LogCodeCell extends CodeCellWidget {
|
|
this.methods.push('onModelChanged');
|
|
this.methods.push('onModelChanged');
|
|
}
|
|
}
|
|
|
|
|
|
- protected onModelStateChanged(model: ICellModel, args: IChangedArgs<any>): void {
|
|
|
|
|
|
+ protected onModelStateChanged(model: ICellModel, args: any): void {
|
|
super.onModelStateChanged(model, args);
|
|
super.onModelStateChanged(model, args);
|
|
this.methods.push('onModelStateChanged');
|
|
this.methods.push('onModelStateChanged');
|
|
}
|
|
}
|
|
@@ -316,7 +312,7 @@ describe('notebook/cells/widget', () => {
|
|
|
|
|
|
it('should focus the cell editor', () => {
|
|
it('should focus the cell editor', () => {
|
|
let widget = new BaseCellWidget();
|
|
let widget = new BaseCellWidget();
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
expect(widget.editor.editor.hasFocus()).to.be(false);
|
|
expect(widget.editor.editor.hasFocus()).to.be(false);
|
|
widget.focus();
|
|
widget.focus();
|
|
expect(widget.editor.editor.hasFocus()).to.be(true);
|
|
expect(widget.editor.editor.hasFocus()).to.be(true);
|
|
@@ -343,7 +339,7 @@ describe('notebook/cells/widget', () => {
|
|
it('should toggle whether the input is shown', () => {
|
|
it('should toggle whether the input is shown', () => {
|
|
let widget = new BaseCellWidget();
|
|
let widget = new BaseCellWidget();
|
|
let input = widget.node.getElementsByClassName(INPUT_CLASS)[0];
|
|
let input = widget.node.getElementsByClassName(INPUT_CLASS)[0];
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
expect(window.getComputedStyle(input).display).to.not.be('none');
|
|
expect(window.getComputedStyle(input).display).to.not.be('none');
|
|
widget.toggleInput(false);
|
|
widget.toggleInput(false);
|
|
expect(window.getComputedStyle(input).display).to.be('none');
|
|
expect(window.getComputedStyle(input).display).to.be('none');
|
|
@@ -375,7 +371,7 @@ describe('notebook/cells/widget', () => {
|
|
it('should run when widget is attached', () => {
|
|
it('should run when widget is attached', () => {
|
|
let widget = new LogBaseCell();
|
|
let widget = new LogBaseCell();
|
|
expect(widget.methods).to.not.contain('onAfterAttach');
|
|
expect(widget.methods).to.not.contain('onAfterAttach');
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
expect(widget.methods).to.contain('onAfterAttach');
|
|
expect(widget.methods).to.contain('onAfterAttach');
|
|
widget.dispose();
|
|
widget.dispose();
|
|
});
|
|
});
|
|
@@ -387,7 +383,7 @@ describe('notebook/cells/widget', () => {
|
|
it('should update the widget', () => {
|
|
it('should update the widget', () => {
|
|
let widget = new LogBaseCell();
|
|
let widget = new LogBaseCell();
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
- sendMessage(widget, Widget.MsgUpdateRequest);
|
|
|
|
|
|
+ sendMessage(widget, WidgetMessage.UpdateRequest);
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
});
|
|
});
|
|
|
|
|
|
@@ -554,7 +550,7 @@ describe('notebook/cells/widget', () => {
|
|
it('should update the widget', () => {
|
|
it('should update the widget', () => {
|
|
let widget = new LogCodeCell({ rendermime });
|
|
let widget = new LogCodeCell({ rendermime });
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
- sendMessage(widget, Widget.MsgUpdateRequest);
|
|
|
|
|
|
+ sendMessage(widget, WidgetMessage.UpdateRequest);
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
});
|
|
});
|
|
|
|
|
|
@@ -669,7 +665,7 @@ describe('notebook/cells/widget', () => {
|
|
|
|
|
|
it('should default to true', (done) => {
|
|
it('should default to true', (done) => {
|
|
let widget = new MarkdownCellWidget({ rendermime });
|
|
let widget = new MarkdownCellWidget({ rendermime });
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
expect(widget.rendered).to.be(true);
|
|
expect(widget.rendered).to.be(true);
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
expect(widget.node.classList.contains(RENDERED_CLASS)).to.be(true);
|
|
expect(widget.node.classList.contains(RENDERED_CLASS)).to.be(true);
|
|
@@ -680,7 +676,7 @@ describe('notebook/cells/widget', () => {
|
|
|
|
|
|
it('should unrender the widget', (done) => {
|
|
it('should unrender the widget', (done) => {
|
|
let widget = new MarkdownCellWidget({ rendermime });
|
|
let widget = new MarkdownCellWidget({ rendermime });
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
widget.rendered = false;
|
|
widget.rendered = false;
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
expect(widget.node.classList.contains(RENDERED_CLASS)).to.be(false);
|
|
expect(widget.node.classList.contains(RENDERED_CLASS)).to.be(false);
|
|
@@ -691,7 +687,7 @@ describe('notebook/cells/widget', () => {
|
|
|
|
|
|
it('should ignore being set to the same value', (done) => {
|
|
it('should ignore being set to the same value', (done) => {
|
|
let widget = new LogMarkdownCell({ rendermime });
|
|
let widget = new LogMarkdownCell({ rendermime });
|
|
- widget.attach(document.body);
|
|
|
|
|
|
+ Widget.attach(widget, document.body);
|
|
widget.rendered = false;
|
|
widget.rendered = false;
|
|
widget.rendered = false;
|
|
widget.rendered = false;
|
|
requestAnimationFrame(() => {
|
|
requestAnimationFrame(() => {
|
|
@@ -727,7 +723,7 @@ describe('notebook/cells/widget', () => {
|
|
it('should update the widget', () => {
|
|
it('should update the widget', () => {
|
|
let widget = new LogMarkdownCell({ rendermime });
|
|
let widget = new LogMarkdownCell({ rendermime });
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
expect(widget.methods).to.not.contain('onUpdateRequest');
|
|
- sendMessage(widget, Widget.MsgUpdateRequest);
|
|
|
|
|
|
+ sendMessage(widget, WidgetMessage.UpdateRequest);
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
expect(widget.methods).to.contain('onUpdateRequest');
|
|
});
|
|
});
|
|
|
|
|