From b732b5b59662ea607daf47bfafe674e20142ad40 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 19 May 2021 18:13:31 +0200 Subject: [PATCH] Revert "Change back signature of shell.currentWidget" (#124) This reverts commit 5e5b54baa41ee161bc96ac028528985fcfcda38c. --- packages/application/src/shell.ts | 4 ++-- packages/application/test/shell.spec.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/application/src/shell.ts b/packages/application/src/shell.ts index 4910378ac..70dc9d3b4 100644 --- a/packages/application/src/shell.ts +++ b/packages/application/src/shell.ts @@ -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; } /** diff --git a/packages/application/test/shell.spec.ts b/packages/application/test/shell.spec.ts index a1296ef07..e0910a1b0 100644 --- a/packages/application/test/shell.spec.ts +++ b/packages/application/test/shell.spec.ts @@ -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); }); });