Skip to content

Commit 3004b03

Browse files
committed
Add missing expect_max_height method for value box controllers
1 parent 62f0000 commit 3004b03

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

shiny/playwright/controller/_card.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,21 @@ def expect_height(self, value: StyleValue, *, timeout: Timeout = None) -> None:
239239
timeout
240240
The maximum time to wait for the expectation to pass. Defaults to `None`.
241241
"""
242+
_expect_style_to_have_value(
243+
self.loc_container, "height", value, timeout=timeout
244+
)
245+
246+
def expect_max_height(self, value: StyleValue, *, timeout: Timeout = None) -> None:
247+
"""
248+
Expects the value box to have a specific maximum height.
249+
250+
Parameters
251+
----------
252+
value
253+
The expected maximum height value.
254+
timeout
255+
The maximum time to wait for the expectation to pass. Defaults to `None`.
256+
"""
242257
_expect_style_to_have_value(
243258
self.loc_container, "max-height", value, timeout=timeout
244259
)

tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_valuebox(page: Page, local_app: ShinyAppProc) -> None:
9999
assert get_value_box_bg_color(value_box4) == "rgb(255, 255, 255)"
100100

101101
value_box5 = controller.ValueBox(page, "valuebox5")
102-
value_box5.expect_height("500px")
102+
value_box5.expect_max_height("500px")
103103
assert get_title_tag_name(value_box5) == "p"
104104
value_box5.expect_title("No showcase w/ showcase layout")
105105
value_box5.expect_value("Red text - fill is False")

tests/playwright/shiny/components/value_box/smoke/test_valuebox.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> Non
1919
value_box.expect_value("$1 Billion Dollars")
2020
value_box.expect_body(["30% VS PREVIOUS 30 DAYS"])
2121
else:
22-
value_box.expect_height("500px")
22+
value_box.expect_max_height("500px")
23+
value_box.expect_height("300px")
2324
value_box.expect_title("title")
2425
value_box.expect_value("value")
2526
value_box.expect_body(["content", "more body"])

0 commit comments

Comments
 (0)