@@ -221,3 +221,48 @@ def updateDynamic(n_clicks):
221
221
dash_dcc .wait_for_text_to_equal ("#btn-3" , "changed" )
222
222
223
223
assert not dash_dcc .get_logs ()
224
+
225
+
226
+ def test_ldcp006_children_identity (dash_dcc ):
227
+ lock = Lock ()
228
+
229
+ app = dash .Dash (__name__ )
230
+ app .layout = html .Div ([
231
+ html .Button ("click" , id = "btn" ),
232
+ dcc .Loading (dcc .Graph (id = "graph" ), className = "loading" )
233
+ ])
234
+
235
+ @app .callback (Output ("graph" , "figure" ), [Input ("btn" , "n_clicks" )])
236
+ def update_graph (n ):
237
+ with lock :
238
+ bars = list (range (2 , (n or 0 ) + 5 ))
239
+ return {
240
+ "data" : [{"type" : "bar" , "x" : bars , "y" : bars }],
241
+ "layout" : {"width" : 400 , "height" : 400 }
242
+ }
243
+
244
+ with lock :
245
+ dash_dcc .start_server (app )
246
+ dash_dcc .find_element (".loading .dash-spinner" )
247
+ dash_dcc .find_element ("#graph .js-plotly-plot" )
248
+ dash_dcc .driver .execute_script (
249
+ "window.gd = document.querySelector('.js-plotly-plot');"
250
+ "window.gd.__test__ = 'boo';"
251
+ )
252
+
253
+ test_identity = (
254
+ "var gd_ = document.querySelector('.js-plotly-plot');"
255
+ "return gd_ === window.gd && gd_.__test__ === 'boo';"
256
+ )
257
+
258
+ assert len (dash_dcc .find_elements ('.js-plotly-plot .bars path' )) == 3
259
+ assert dash_dcc .driver .execute_script (test_identity )
260
+
261
+ with lock :
262
+ dash_dcc .find_element ("#btn" ).click ()
263
+ dash_dcc .find_element (".loading .dash-spinner" )
264
+ assert len (dash_dcc .find_elements ('.js-plotly-plot .bars path' )) == 3
265
+ assert dash_dcc .driver .execute_script (test_identity )
266
+
267
+ assert len (dash_dcc .find_elements ('.js-plotly-plot .bars path' )) == 4
268
+ assert dash_dcc .driver .execute_script (test_identity )
0 commit comments