MCPcopy
hub / github.com/plotly/dash / test_rdps004_show_hide

Function test_rdps004_show_hide

tests/integration/renderer/test_persistence.py:173–207  ·  view source on GitHub ↗
(dash_duo)

Source from the content-addressed store, hash-verified

171
172
173def 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)

Callers

nothing calls this directly

Calls 7

DashClass · 0.90
check_table_namesFunction · 0.85
rename_and_hideFunction · 0.85
find_elementMethod · 0.80
start_serverMethod · 0.45
clickMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…