|
@@ -9,6 +9,10 @@ import {
|
|
|
h, VirtualNode
|
|
|
} from '@phosphor/virtualdom';
|
|
|
|
|
|
+import {
|
|
|
+ Widget
|
|
|
+} from '@phosphor/widgets'
|
|
|
+
|
|
|
import {
|
|
|
VDomModel, VDomRenderer
|
|
|
} from '@jupyterlab/apputils';
|
|
@@ -33,6 +37,12 @@ class TestWidget extends VDomRenderer<TestModel> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+class TestWidgetNoModel extends VDomRenderer<null> {
|
|
|
+ protected render(): VirtualNode {
|
|
|
+ return h.span("No model!");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
describe('@jupyterlab/domutils', () => {
|
|
|
|
|
@@ -116,6 +126,20 @@ describe('@jupyterlab/domutils', () => {
|
|
|
|
|
|
});
|
|
|
|
|
|
+ describe('#noModel()', () => {
|
|
|
+
|
|
|
+ it('should work with a null model', (done) => {
|
|
|
+ let widget = new TestWidgetNoModel();
|
|
|
+ Widget.attach(widget, document.body);
|
|
|
+ requestAnimationFrame(() => {
|
|
|
+ let span = widget.node.firstChild as HTMLElement;
|
|
|
+ expect(span.textContent).to.equal('No model!');
|
|
|
+ done();
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
});
|
|
|
|
|
|
});
|