Revert "Change back signature of shell.currentWidget" (#124)

This reverts commit 5e5b54baa4.
Jeremy Tuloup 5 years ago committed by GitHub
parent da6df982d6
commit b732b5b596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -85,8 +85,8 @@ export class RetroShell extends Widget implements JupyterFrontEnd.IShell {
/**
* The current widget in the shell's main area.
*/
get currentWidget(): Widget {
return this._main.widgets[0];
get currentWidget(): Widget | null {
return this._main.widgets[0] ?? null;
}
/**

@ -45,15 +45,15 @@ describe('Shell', () => {
describe('#currentWidget', () => {
it('should be the current widget in the shell main area', () => {
expect(shell.currentWidget).toBe(undefined);
expect(shell.currentWidget).toBe(null);
const widget = new Widget();
widget.node.tabIndex = -1;
widget.id = 'foo';
expect(shell.currentWidget).toBe(undefined);
expect(shell.currentWidget).toBe(null);
shell.add(widget, 'main');
expect(shell.currentWidget).toBe(widget);
widget.parent = null;
expect(shell.currentWidget).toBe(undefined);
expect(shell.currentWidget).toBe(null);
});
});

Loading…
Cancel
Save