@@ -262,3 +262,43 @@ def on_click(n_clicks):
262
262
dash_duo .wait_for_text_to_equal ("#output" , "1" )
263
263
dash_duo .find_element ("#btn" ).click ()
264
264
dash_duo .wait_for_text_to_equal ("#output" , "2" )
265
+
266
+
267
+ def test_cbmt007_early_preventupdate_inputs_above_below (dash_duo ):
268
+ app = dash .Dash (__name__ , suppress_callback_exceptions = True )
269
+ app .layout = html .Div (id = "content" )
270
+
271
+ @app .callback (Output ("content" , "children" ), [Input ("content" , "style" )])
272
+ def content (_ ):
273
+ return html .Div ([
274
+ html .Div (42 , id = "above-in" ),
275
+ html .Div (id = "above-dummy" ),
276
+ html .Hr (),
277
+ html .Div (0 , id = 'above-out' ),
278
+ html .Div (0 , id = 'below-out' ),
279
+ html .Hr (),
280
+ html .Div (id = "below-dummy" ),
281
+ html .Div (44 , id = "below-in" ),
282
+ ])
283
+
284
+ # Create 4 callbacks - 2 above, 2 below.
285
+ for pos in ('above' , 'below' ):
286
+ @app .callback (
287
+ Output ("{}-dummy" .format (pos ), "children" ),
288
+ [Input ("{}-dummy" .format (pos ), "style" )]
289
+ )
290
+ def dummy (_ ):
291
+ raise PreventUpdate
292
+
293
+ @app .callback (
294
+ Output ('{}-out' .format (pos ), 'children' ),
295
+ [Input ('{}-in' .format (pos ), 'children' )]
296
+ )
297
+ def out (v ):
298
+ return v
299
+
300
+ dash_duo .start_server (app )
301
+
302
+ # as of https://github.com/plotly/dash/issues/1223, above-out would be 0
303
+ dash_duo .wait_for_text_to_equal ("#above-out" , "42" )
304
+ dash_duo .wait_for_text_to_equal ("#below-out" , "44" )
0 commit comments