File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,15 @@ def test_widget_view():
43
43
assert 'application/vnd.jupyter.widget-view+json' in mime_bundle , "widget should have have a view"
44
44
assert cap .stdout == '' , repr (cap .stdout )
45
45
assert cap .stderr == '' , repr (cap .stderr )
46
+
47
+
48
+ def test_close_all ():
49
+ # create a couple of widgets
50
+ widgets = [Button () for i in range (10 )]
51
+
52
+ assert len (Widget ._active_widgets ) > 0 , "expect active widgets"
53
+
54
+ # close all the widgets
55
+ Widget .close_all ()
56
+
57
+ assert len (Widget ._active_widgets ) == 0 , "active widgets should be cleared"
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ class Widget(LoggingHasTraits):
271
271
272
272
@classmethod
273
273
def close_all (cls ):
274
- for widget in list (cls .widgets .values ()):
274
+ for widget in list (cls ._active_widgets .values ()):
275
275
widget .close ()
276
276
277
277
You can’t perform that action at this time.
0 commit comments