Skip to content

Commit 63a684d

Browse files
committed
Prevent initial call in html tests.
1 parent 12fc60a commit 63a684d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

components/dash-html-components/tests/test_integration.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ def test_click_simple(dash_duo):
1616
]
1717
)
1818

19-
@app.callback(Output("container", "children"), Input("button", "n_clicks"))
19+
@app.callback(
20+
Output("container", "children"),
21+
Input("button", "n_clicks"),
22+
prevent_initial_call=True,
23+
)
2024
def update_output(n_clicks):
2125
call_count.value += 1
2226
return "clicked {} times".format(n_clicks)
@@ -25,14 +29,13 @@ def update_output(n_clicks):
2529

2630
dash_duo.find_element("#container")
2731

28-
dash_duo.wait_for_text_to_equal("#container", "clicked 0 times")
29-
assert call_count.value == 1
32+
assert call_count.value == 0
3033
dash_duo.percy_snapshot("html button initialization")
3134

3235
dash_duo.find_element("#button").click()
3336

3437
dash_duo.wait_for_text_to_equal("#container", "clicked 1 times")
35-
assert call_count.value == 2
38+
assert call_count.value == 1
3639
dash_duo.percy_snapshot("html button click")
3740

3841
assert not dash_duo.get_logs()
@@ -63,6 +66,7 @@ def test_click_prev(dash_duo):
6366
Input("button-2", "n_clicks"),
6467
Input("button-2", "n_clicks_timestamp"),
6568
],
69+
prevent_inital_call=True,
6670
)
6771
def update_output(*args):
6872
print(args)

0 commit comments

Comments
 (0)