(dash_duo)
| 171 | |
| 172 | |
| 173 | def test_rdps004_show_hide(dash_duo): |
| 174 | app = Dash(__name__) |
| 175 | app.layout = html.Div( |
| 176 | [html.Button("Show/Hide", id="toggle-table"), html.Div(id="container")] |
| 177 | ) |
| 178 | |
| 179 | @app.callback(Output("container", "children"), [Input("toggle-table", "n_clicks")]) |
| 180 | def toggle_table(n): |
| 181 | if (n or 0) % 2: |
| 182 | return "nope" |
| 183 | return simple_table( |
| 184 | persistence_type="memory", persistence=1 if (n or 0) < 3 else 2 |
| 185 | ) |
| 186 | |
| 187 | dash_duo.start_server(app) |
| 188 | check_table_names(dash_duo, ["a", "b"]) |
| 189 | |
| 190 | rename_and_hide(dash_duo) |
| 191 | check_table_names(dash_duo, [NEW_NAME]) |
| 192 | |
| 193 | dash_duo.find_element("#toggle-table").click() |
| 194 | # table is gone |
| 195 | dash_duo.wait_for_text_to_equal("#container", "nope") |
| 196 | |
| 197 | dash_duo.find_element("#toggle-table").click() |
| 198 | # table is back, with persisted props |
| 199 | check_table_names(dash_duo, [NEW_NAME]) |
| 200 | |
| 201 | dash_duo.find_element("#toggle-table").click() |
| 202 | # gone again |
| 203 | dash_duo.wait_for_text_to_equal("#container", "nope") |
| 204 | |
| 205 | dash_duo.find_element("#toggle-table").click() |
| 206 | # table is back, new persistence val so props not persisted |
| 207 | check_table_names(dash_duo, ["a", "b"]) |
| 208 | |
| 209 | |
| 210 | @flaky.flaky(max_runs=3) |
nothing calls this directly
no test coverage detected
searching dependent graphs…