Skip to content

Commit

Permalink
failing callback test with not-loaded async component
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-André Rivet committed Nov 22, 2019
1 parent 53d8fcc commit f5e577e
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion tests/integration/callbacks/test_basic_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

import dash_core_components as dcc
import dash_html_components as html
import dash_table
import dash
from dash.dependencies import Input, Output
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate


def test_cbsc001_simple_callback(dash_duo):
Expand Down Expand Up @@ -140,3 +142,35 @@ def update_input(value):

dash_duo.percy_snapshot(name="callback-generating-function-2")
assert dash_duo.get_logs() == [], "console is clean"


def test_cbsc003_callback_with_unloaded_async_component(dash_duo):
app = dash.Dash()
app.layout = html.Div(
children=[
dcc.Tabs(
children=[
dcc.Tab(
children=[
html.Button(id="btn", children="Update Input"),
html.Div(id="output", children=["Hello"]),
]
),
dcc.Tab(children=dash_table.DataTable(id="other-table")),
]
)
]
)

@app.callback(Output("output", "children"), [Input("btn", "n_clicks")])
def update_graph(n_clicks):
if n_clicks is None:
raise PreventUpdate

return "Bye"

dash_duo.start_server(app)

dash_duo.find_element('#btn').click()
assert dash_duo.find_element('#output').text == "Bye"
assert dash_duo.get_logs() == []

0 comments on commit f5e577e

Please sign in to comment.