@@ -63,6 +63,83 @@ describe('Output widget', function () {
6363 expect ( elt . querySelectorAll ( 'table' ) . length ) . to . equal ( 1 ) ;
6464 } ) ;
6565
66+ it ( 'renders widgets ipywidgets 7' , async function ( ) {
67+ const modelState = {
68+ _view_module : '@jupyter-widgets/output' ,
69+ outputs : [
70+ {
71+ output_type : 'display_data' ,
72+ data : {
73+ 'application/vnd.jupyter.widget-view+json' : {
74+ model_id : 'adffc4580a0944f6929c381463b0059b' ,
75+ version_minor : 0 ,
76+ version_major : 2 ,
77+ } ,
78+ 'text/plain' : 'A Jupyter Widget' ,
79+ } ,
80+ metadata : { } ,
81+ } ,
82+ ] ,
83+ } ;
84+
85+ const elt = document . createElement ( 'div' ) ;
86+ elt . className = 'widget-subarea' ;
87+ document . body . appendChild ( elt ) ;
88+ const manager = new HTMLManager ( ) ;
89+
90+ // We need to seed the manager with the state of the widgets
91+ const managerState = {
92+ adffc4580a0944f6929c381463b0059b : {
93+ model_name : 'IntSliderModel' ,
94+ model_module : '@jupyter-widgets/controls' ,
95+ model_module_version : '1.5.0' ,
96+ state : {
97+ style : 'IPY_MODEL_3b8780f457254737a83be48bc32b0613' ,
98+ _view_module : '@jupyter-widgets/controls' ,
99+ layout : 'IPY_MODEL_33cb011834fd4c9d9af512e5e98c9904' ,
100+ value : 45 ,
101+ _model_module : '@jupyter-widgets/controls' ,
102+ } ,
103+ } ,
104+ '3b8780f457254737a83be48bc32b0613' : {
105+ model_name : 'SliderStyleModel' ,
106+ model_module : '@jupyter-widgets/controls' ,
107+ model_module_version : '1.5.0' ,
108+ state : {
109+ description_width : '' ,
110+ _model_module : '@jupyter-widgets/controls' ,
111+ } ,
112+ } ,
113+ '33cb011834fd4c9d9af512e5e98c9904' : {
114+ model_name : 'LayoutModel' ,
115+ model_module : '@jupyter-widgets/base' ,
116+ model_module_version : '1.2.0' ,
117+ state : { } ,
118+ } ,
119+ } ;
120+ await manager . set_state ( {
121+ state : managerState ,
122+ version_major : 2 ,
123+ version_minor : 0 ,
124+ } ) ;
125+ const modelId = 'u-u-i-d' ;
126+ const modelCreate : base . IModelOptions = {
127+ model_name : 'OutputModel' ,
128+ model_id : modelId ,
129+ model_module : '@jupyter-widgets/output' ,
130+ model_module_version : '*' ,
131+ } ;
132+ const model = await manager . new_model ( modelCreate , modelState ) ;
133+ await manager . display_view ( manager . create_view ( model ) , elt ) ;
134+
135+ // Give the widget time to render
136+ await new Promise ( ( resolve ) => {
137+ setTimeout ( resolve , 20 ) ;
138+ } ) ;
139+
140+ expect ( elt . querySelectorAll ( '.slider' ) . length ) . to . equal ( 1 ) ;
141+ } ) ;
142+
66143 it ( 'renders widgets' , async function ( ) {
67144 const modelState = {
68145 _view_module : '@jupyter-widgets/output' ,
@@ -92,7 +169,7 @@ describe('Output widget', function () {
92169 adffc4580a0944f6929c381463b0059b : {
93170 model_name : 'IntSliderModel' ,
94171 model_module : '@jupyter-widgets/controls' ,
95- model_module_version : '1 .0.0' ,
172+ model_module_version : '2 .0.0' ,
96173 state : {
97174 style : 'IPY_MODEL_3b8780f457254737a83be48bc32b0613' ,
98175 _view_module : '@jupyter-widgets/controls' ,
@@ -104,7 +181,7 @@ describe('Output widget', function () {
104181 '3b8780f457254737a83be48bc32b0613' : {
105182 model_name : 'SliderStyleModel' ,
106183 model_module : '@jupyter-widgets/controls' ,
107- model_module_version : '1 .0.0' ,
184+ model_module_version : '2 .0.0' ,
108185 state : {
109186 description_width : '' ,
110187 _model_module : '@jupyter-widgets/controls' ,
@@ -113,7 +190,7 @@ describe('Output widget', function () {
113190 '33cb011834fd4c9d9af512e5e98c9904' : {
114191 model_name : 'LayoutModel' ,
115192 model_module : '@jupyter-widgets/base' ,
116- model_module_version : '1 .0.0' ,
193+ model_module_version : '2 .0.0' ,
117194 state : { } ,
118195 } ,
119196 } ;
0 commit comments