diff --git a/tests/integration/callbacks/test_multiple_callbacks.py b/tests/integration/callbacks/test_multiple_callbacks.py index 84c8af1d78..30a01b162c 100644 --- a/tests/integration/callbacks/test_multiple_callbacks.py +++ b/tests/integration/callbacks/test_multiple_callbacks.py @@ -2,8 +2,10 @@ from multiprocessing import Value import dash_html_components as html +import dash_core_components as dcc import dash from dash.dependencies import Input, Output +from dash.exceptions import PreventUpdate def test_cbmt001_called_multiple_times_and_out_of_order(dash_duo): @@ -36,3 +38,37 @@ def update_output(n_clicks): dash_duo.percy_snapshot( name="test_callbacks_called_multiple_times_and_out_of_order" ) + + +def test_cbmt002_canceled_intermediate_callback(dash_duo): + # see https://github.com/plotly/dash/issues/1053 + app = dash.Dash(__name__) + app.layout = html.Div([ + dcc.Input(id='a', value="x"), + html.Div('b', id='b'), + html.Div('c', id='c'), + html.Div(id='out') + ]) + + @app.callback( + Output("out", "children"), + [Input("a", "value"), Input("b", "children"), Input("c", "children")] + ) + def set_out(a, b, c): + return "{}/{}/{}".format(a, b, c) + + @app.callback(Output("b", "children"), [Input("a", "value")]) + def set_b(a): + raise PreventUpdate + + @app.callback(Output("c", "children"), [Input("a", "value")]) + def set_c(a): + return a + + dash_duo.start_server(app) + dash_duo.wait_for_text_to_equal("#out", "x/b/x") + chars = "x" + for i in list(range(10)) * 2: + dash_duo.find_element("#a").send_keys(str(i)) + chars += str(i) + dash_duo.wait_for_text_to_equal("#out", "{0}/b/{0}".format(chars))