@@ -16,7 +16,11 @@ def test_click_simple(dash_duo):
16
16
]
17
17
)
18
18
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
+ )
20
24
def update_output (n_clicks ):
21
25
call_count .value += 1
22
26
return "clicked {} times" .format (n_clicks )
@@ -25,14 +29,13 @@ def update_output(n_clicks):
25
29
26
30
dash_duo .find_element ("#container" )
27
31
28
- dash_duo .wait_for_text_to_equal ("#container" , "clicked 0 times" )
29
- assert call_count .value == 1
32
+ assert call_count .value == 0
30
33
dash_duo .percy_snapshot ("html button initialization" )
31
34
32
35
dash_duo .find_element ("#button" ).click ()
33
36
34
37
dash_duo .wait_for_text_to_equal ("#container" , "clicked 1 times" )
35
- assert call_count .value == 2
38
+ assert call_count .value == 1
36
39
dash_duo .percy_snapshot ("html button click" )
37
40
38
41
assert not dash_duo .get_logs ()
@@ -63,6 +66,7 @@ def test_click_prev(dash_duo):
63
66
Input ("button-2" , "n_clicks" ),
64
67
Input ("button-2" , "n_clicks_timestamp" ),
65
68
],
69
+ prevent_inital_call = True ,
66
70
)
67
71
def update_output (* args ):
68
72
print (args )
0 commit comments