mirror of
https://github.com/jupyter/notebook.git
synced 2024-11-27 03:20:27 +08:00
Remove isEmpty
from the shell API (only used for tests)
This commit is contained in:
parent
820ee98806
commit
94eadd817a
@ -318,16 +318,6 @@ export class NotebookShell extends Widget implements JupyterFrontEnd.IShell {
|
||||
this._rightHandler.panel.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a particular area empty (no widgets)?
|
||||
*
|
||||
* @param area Named area in the application
|
||||
* @returns true if area has no widgets, false if at least one widget is present
|
||||
*/
|
||||
isEmpty(area: Shell.Area): boolean {
|
||||
return Array.from(this.widgets(area)).length === 0;
|
||||
}
|
||||
|
||||
private _topWrapper: Panel;
|
||||
private _topHandler: Private.PanelHandler;
|
||||
private _menuWrapper: Panel;
|
||||
|
@ -29,9 +29,10 @@ describe('Shell for notebooks', () => {
|
||||
});
|
||||
|
||||
it('should make all areas empty initially', () => {
|
||||
['main', 'top', 'left', 'right', 'menu'].forEach(area =>
|
||||
expect(shell.isEmpty(area as Shell.Area)).toBe(true)
|
||||
);
|
||||
['main', 'top', 'left', 'right', 'menu'].forEach(area => {
|
||||
const widgets = Array.from(shell.widgets(area as Shell.Area));
|
||||
expect(widgets.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -98,7 +99,8 @@ describe('Shell for notebooks', () => {
|
||||
const widget = new Widget();
|
||||
widget.id = 'foo';
|
||||
shell.add(widget, 'left');
|
||||
expect(shell.isEmpty('left')).toBe(false);
|
||||
const widgets = Array.from(shell.widgets('left'));
|
||||
expect(widgets.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@ -107,7 +109,8 @@ describe('Shell for notebooks', () => {
|
||||
const widget = new Widget();
|
||||
widget.id = 'foo';
|
||||
shell.add(widget, 'right');
|
||||
expect(shell.isEmpty('right')).toBe(false);
|
||||
const widgets = Array.from(shell.widgets('right'));
|
||||
expect(widgets.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -130,9 +133,10 @@ describe('Shell for tree view', () => {
|
||||
});
|
||||
|
||||
it('should make all areas empty initially', () => {
|
||||
['main', 'top', 'left', 'right', 'menu'].forEach(area =>
|
||||
expect(shell.isEmpty(area as Shell.Area)).toBe(true)
|
||||
);
|
||||
['main', 'top', 'left', 'right', 'menu'].forEach(area => {
|
||||
const widgets = Array.from(shell.widgets(area as Shell.Area));
|
||||
expect(widgets.length).toEqual(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -157,7 +161,8 @@ describe('Shell for tree view', () => {
|
||||
const widget = new Widget();
|
||||
widget.id = 'foo';
|
||||
shell.add(widget, 'left');
|
||||
expect(shell.isEmpty('left')).toBe(false);
|
||||
const widgets = Array.from(shell.widgets('left'));
|
||||
expect(widgets.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
@ -166,7 +171,8 @@ describe('Shell for tree view', () => {
|
||||
const widget = new Widget();
|
||||
widget.id = 'foo';
|
||||
shell.add(widget, 'right');
|
||||
expect(shell.isEmpty('right')).toBe(false);
|
||||
const widgets = Array.from(shell.widgets('right'));
|
||||
expect(widgets.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user