(dash_duo)
| 563 | |
| 564 | |
| 565 | def test_rdps014_layout_as_list(dash_duo): |
| 566 | # testing persistence with layout as list |
| 567 | app = dash.Dash(__name__) |
| 568 | app.layout = [ |
| 569 | dcc.Input(id="input-1", value="initial", persistence=True), |
| 570 | html.Div(id="output-1"), |
| 571 | dcc.Input(id="input-2", value="second", persistence=True), |
| 572 | html.Div(id="output-2"), |
| 573 | ] |
| 574 | |
| 575 | @app.callback(Output("output-1", "children"), [Input("input-1", "value")]) |
| 576 | def update_output_1(value): |
| 577 | return f"Output 1: {value}" |
| 578 | |
| 579 | @app.callback(Output("output-2", "children"), [Input("input-2", "value")]) |
| 580 | def update_output_2(value): |
| 581 | return f"Output 2: {value}" |
| 582 | |
| 583 | dash_duo.start_server(app) |
| 584 | |
| 585 | # Check initial values |
| 586 | dash_duo.wait_for_text_to_equal("#output-1", "Output 1: initial") |
| 587 | dash_duo.wait_for_text_to_equal("#output-2", "Output 2: second") |
| 588 | |
| 589 | # Change the input values |
| 590 | dash_duo.clear_input("#input-1") |
| 591 | dash_duo.find_element("#input-1").send_keys("changed1") |
| 592 | dash_duo.clear_input("#input-2") |
| 593 | dash_duo.find_element("#input-2").send_keys("changed2") |
| 594 | |
| 595 | # Verify changes |
| 596 | dash_duo.wait_for_text_to_equal("#output-1", "Output 1: changed1") |
| 597 | dash_duo.wait_for_text_to_equal("#output-2", "Output 2: changed2") |
| 598 | |
| 599 | # Reload the page to test persistence |
| 600 | dash_duo.wait_for_page() |
| 601 | |
| 602 | # Check that persisted values are restored |
| 603 | dash_duo.wait_for_text_to_equal("#output-1", "Output 1: changed1") |
| 604 | dash_duo.wait_for_text_to_equal("#output-2", "Output 2: changed2") |
nothing calls this directly
no test coverage detected
searching dependent graphs…