Skip to content

Commit f5e577e

Browse files
author
Marc-André Rivet
committed
failing callback test with not-loaded async component
1 parent 53d8fcc commit f5e577e

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

Diff for: tests/integration/callbacks/test_basic_callback.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
import dash_core_components as dcc
66
import dash_html_components as html
7+
import dash_table
78
import dash
8-
from dash.dependencies import Input, Output
9+
from dash.dependencies import Input, Output, State
10+
from dash.exceptions import PreventUpdate
911

1012

1113
def test_cbsc001_simple_callback(dash_duo):
@@ -140,3 +142,35 @@ def update_input(value):
140142

141143
dash_duo.percy_snapshot(name="callback-generating-function-2")
142144
assert dash_duo.get_logs() == [], "console is clean"
145+
146+
147+
def test_cbsc003_callback_with_unloaded_async_component(dash_duo):
148+
app = dash.Dash()
149+
app.layout = html.Div(
150+
children=[
151+
dcc.Tabs(
152+
children=[
153+
dcc.Tab(
154+
children=[
155+
html.Button(id="btn", children="Update Input"),
156+
html.Div(id="output", children=["Hello"]),
157+
]
158+
),
159+
dcc.Tab(children=dash_table.DataTable(id="other-table")),
160+
]
161+
)
162+
]
163+
)
164+
165+
@app.callback(Output("output", "children"), [Input("btn", "n_clicks")])
166+
def update_graph(n_clicks):
167+
if n_clicks is None:
168+
raise PreventUpdate
169+
170+
return "Bye"
171+
172+
dash_duo.start_server(app)
173+
174+
dash_duo.find_element('#btn').click()
175+
assert dash_duo.find_element('#output').text == "Bye"
176+
assert dash_duo.get_logs() == []

0 commit comments

Comments
 (0)