@@ -5,8 +5,6 @@ import { NotebookShell, INotebookShell } from '@jupyter-notebook/application';
5
5
6
6
import { JupyterFrontEnd } from '@jupyterlab/application' ;
7
7
8
- import { toArray } from '@lumino/algorithm' ;
9
-
10
8
import { Widget } from '@lumino/widgets' ;
11
9
12
10
describe ( 'Shell' , ( ) => {
@@ -31,15 +29,15 @@ describe('Shell', () => {
31
29
it ( 'should add widgets to existing areas' , ( ) => {
32
30
const widget = new Widget ( ) ;
33
31
shell . add ( widget , 'main' ) ;
34
- const widgets = toArray ( shell . widgets ( 'main' ) ) ;
32
+ const widgets = Array . from ( shell . widgets ( 'main' ) ) ;
35
33
expect ( widgets ) . toEqual ( [ widget ] ) ;
36
34
} ) ;
37
35
38
- it ( 'should throw an exception if the area does not exist' , ( ) => {
36
+ it ( 'should be empty and console.error if area does not exist' , ( ) => {
37
+ const spy = jest . spyOn ( console , 'error' ) ;
39
38
const jupyterFrontEndShell = shell as JupyterFrontEnd . IShell ;
40
- expect ( ( ) => {
41
- jupyterFrontEndShell . widgets ( 'left' ) ;
42
- } ) . toThrow ( 'Invalid area: left' ) ;
39
+ expect ( Array . from ( jupyterFrontEndShell . widgets ( 'left' ) ) ) . toHaveLength ( 0 ) ;
40
+ expect ( spy ) . toHaveBeenCalled ( ) ;
43
41
} ) ;
44
42
} ) ;
45
43
@@ -62,15 +60,15 @@ describe('Shell', () => {
62
60
const widget = new Widget ( ) ;
63
61
widget . id = 'foo' ;
64
62
shell . add ( widget , 'top' ) ;
65
- const widgets = toArray ( shell . widgets ( 'top' ) ) ;
63
+ const widgets = Array . from ( shell . widgets ( 'top' ) ) ;
66
64
expect ( widgets . length ) . toBeGreaterThan ( 0 ) ;
67
65
} ) ;
68
66
69
67
it ( 'should accept options' , ( ) => {
70
68
const widget = new Widget ( ) ;
71
69
widget . id = 'foo' ;
72
70
shell . add ( widget , 'top' , { rank : 10 } ) ;
73
- const widgets = toArray ( shell . widgets ( 'top' ) ) ;
71
+ const widgets = Array . from ( shell . widgets ( 'top' ) ) ;
74
72
expect ( widgets . length ) . toBeGreaterThan ( 0 ) ;
75
73
} ) ;
76
74
} ) ;
@@ -80,7 +78,7 @@ describe('Shell', () => {
80
78
const widget = new Widget ( ) ;
81
79
widget . id = 'foo' ;
82
80
shell . add ( widget , 'main' ) ;
83
- const widgets = toArray ( shell . widgets ( 'main' ) ) ;
81
+ const widgets = Array . from ( shell . widgets ( 'main' ) ) ;
84
82
expect ( widgets . length ) . toBeGreaterThan ( 0 ) ;
85
83
} ) ;
86
84
} ) ;
0 commit comments