Skip to content

Commit 94eadd8

Browse files
committed
Remove isEmpty from the shell API (only used for tests)
1 parent 820ee98 commit 94eadd8

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

packages/application/src/shell.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,6 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
318318
this._rightHandler.panel.hide();
319319
}
320320

321-
/**
322-
* Is a particular area empty (no widgets)?
323-
*
324-
* @param area Named area in the application
325-
* @returns true if area has no widgets, false if at least one widget is present
326-
*/
327-
isEmpty(area: Shell.Area): boolean {
328-
return Array.from(this.widgets(area)).length === 0;
329-
}
330-
331321
private _topWrapper: Panel;
332322
private _topHandler: Private.PanelHandler;
333323
private _menuWrapper: Panel;

packages/application/test/shell.spec.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ describe('Shell for notebooks', () => {
2929
});
3030

3131
it('should make all areas empty initially', () => {
32-
['main', 'top', 'left', 'right', 'menu'].forEach(area =>
33-
expect(shell.isEmpty(area as Shell.Area)).toBe(true)
34-
);
32+
['main', 'top', 'left', 'right', 'menu'].forEach(area => {
33+
const widgets = Array.from(shell.widgets(area as Shell.Area));
34+
expect(widgets.length).toEqual(0);
35+
});
3536
});
3637
});
3738

@@ -98,7 +99,8 @@ describe('Shell for notebooks', () => {
9899
const widget = new Widget();
99100
widget.id = 'foo';
100101
shell.add(widget, 'left');
101-
expect(shell.isEmpty('left')).toBe(false);
102+
const widgets = Array.from(shell.widgets('left'));
103+
expect(widgets.length).toBeGreaterThan(0);
102104
});
103105
});
104106

@@ -107,7 +109,8 @@ describe('Shell for notebooks', () => {
107109
const widget = new Widget();
108110
widget.id = 'foo';
109111
shell.add(widget, 'right');
110-
expect(shell.isEmpty('right')).toBe(false);
112+
const widgets = Array.from(shell.widgets('right'));
113+
expect(widgets.length).toBeGreaterThan(0);
111114
});
112115
});
113116
});
@@ -130,9 +133,10 @@ describe('Shell for tree view', () => {
130133
});
131134

132135
it('should make all areas empty initially', () => {
133-
['main', 'top', 'left', 'right', 'menu'].forEach(area =>
134-
expect(shell.isEmpty(area as Shell.Area)).toBe(true)
135-
);
136+
['main', 'top', 'left', 'right', 'menu'].forEach(area => {
137+
const widgets = Array.from(shell.widgets(area as Shell.Area));
138+
expect(widgets.length).toEqual(0);
139+
});
136140
});
137141
});
138142

@@ -157,7 +161,8 @@ describe('Shell for tree view', () => {
157161
const widget = new Widget();
158162
widget.id = 'foo';
159163
shell.add(widget, 'left');
160-
expect(shell.isEmpty('left')).toBe(false);
164+
const widgets = Array.from(shell.widgets('left'));
165+
expect(widgets.length).toBeGreaterThan(0);
161166
});
162167
});
163168

@@ -166,7 +171,8 @@ describe('Shell for tree view', () => {
166171
const widget = new Widget();
167172
widget.id = 'foo';
168173
shell.add(widget, 'right');
169-
expect(shell.isEmpty('right')).toBe(false);
174+
const widgets = Array.from(shell.widgets('right'));
175+
expect(widgets.length).toBeGreaterThan(0);
170176
});
171177
});
172178
});

0 commit comments

Comments
 (0)