Skip to content

Commit 8ec0e2e

Browse files
committed
fix html test typo and test
1 parent 63a684d commit 8ec0e2e

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def test_click_simple(dash_duo):
1919
@app.callback(
2020
Output("container", "children"),
2121
Input("button", "n_clicks"),
22+
# The new percy runner loads the page, so to get consistent behavior for
23+
# call_count we need to skip the initial call
2224
prevent_initial_call=True,
2325
)
2426
def update_output(n_clicks):
@@ -52,7 +54,7 @@ def test_click_prev(dash_duo):
5254
app = Dash(__name__)
5355
app.layout = html.Div(
5456
[
55-
html.Div(id="container"),
57+
html.Div("Initial", id="container"),
5658
html.Button("Click", id="button-1", n_clicks=0, n_clicks_timestamp=-1),
5759
html.Button("Click", id="button-2", n_clicks=0, n_clicks_timestamp=-1),
5860
]
@@ -66,7 +68,7 @@ def test_click_prev(dash_duo):
6668
Input("button-2", "n_clicks"),
6769
Input("button-2", "n_clicks_timestamp"),
6870
],
69-
prevent_inital_call=True,
71+
prevent_initial_call=True,
7072
)
7173
def update_output(*args):
7274
print(args)
@@ -77,25 +79,25 @@ def update_output(*args):
7779

7880
dash_duo.start_server(app)
7981

80-
dash_duo.wait_for_text_to_equal("#container", "0, 0")
81-
assert timestamp_1.value == -1
82-
assert timestamp_2.value == -1
83-
assert call_count.value == 1
82+
dash_duo.wait_for_text_to_equal("#container", "Initial")
83+
assert timestamp_1.value == -5
84+
assert timestamp_2.value == -5
85+
assert call_count.value == 0
8486
dash_duo.percy_snapshot("html button initialization 1")
8587

8688
dash_duo.find_element("#button-1").click()
8789
dash_duo.wait_for_text_to_equal("#container", "1, 0")
8890
assert timestamp_1.value > ((time.time() - (24 * 60 * 60)) * 1000)
8991
assert timestamp_2.value == -1
90-
assert call_count.value == 2
92+
assert call_count.value == 1
9193
dash_duo.percy_snapshot("html button-1 click")
9294
prev_timestamp_1 = timestamp_1.value
9395

9496
dash_duo.find_element("#button-2").click()
9597
dash_duo.wait_for_text_to_equal("#container", "1, 1")
9698
assert timestamp_1.value == prev_timestamp_1
9799
assert timestamp_2.value > ((time.time() - 24 * 60 * 60) * 1000)
98-
assert call_count.value == 3
100+
assert call_count.value == 2
99101
dash_duo.percy_snapshot("html button-2 click")
100102
prev_timestamp_2 = timestamp_2.value
101103

@@ -104,7 +106,7 @@ def update_output(*args):
104106
assert timestamp_1.value == prev_timestamp_1
105107
assert timestamp_2.value > prev_timestamp_2
106108
assert timestamp_2.value > timestamp_1.value
107-
assert call_count.value == 4
109+
assert call_count.value == 3
108110
dash_duo.percy_snapshot("html button-2 click again")
109111

110112
assert not dash_duo.get_logs()

0 commit comments

Comments
 (0)