MCPcopy Index your code
hub / github.com/plotly/dash / test_inin031_initial_value_set_back

Function test_inin031_initial_value_set_back

tests/integration/test_integration.py:477–508  ·  view source on GitHub ↗
(dash_duo)

Source from the content-addressed store, hash-verified

475
476
477def test_inin031_initial_value_set_back(dash_duo):
478 # Test for regression on the initial value to be able to
479 # set back to initial after changing again.
480 app = Dash(__name__)
481
482 app.layout = html.Div(
483 [
484 dcc.Dropdown(
485 id="dropdown",
486 options=["Toronto", "Montréal", "Vancouver"],
487 value="Toronto",
488 searchable=False,
489 ),
490 html.Div(id="output"),
491 ]
492 )
493
494 @app.callback(Output("output", "children"), [Input("dropdown", "value")])
495 def callback(value):
496 return f"You have selected {value}"
497
498 dash_duo.start_server(app)
499
500 dash_duo.wait_for_text_to_equal("#output", "You have selected Toronto")
501
502 dash_duo.select_dcc_dropdown("#dropdown", "Vancouver")
503 dash_duo.wait_for_text_to_equal("#output", "You have selected Vancouver")
504
505 dash_duo.select_dcc_dropdown("#dropdown", "Toronto")
506 dash_duo.wait_for_text_to_equal("#output", "You have selected Toronto")
507
508 assert dash_duo.get_logs() == []

Callers

nothing calls this directly

Calls 5

DashClass · 0.90
select_dcc_dropdownMethod · 0.80
get_logsMethod · 0.80
start_serverMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…