Skip to content

Commit 45699fa

Browse files
authored
fix(controllers): Add missing expect_max_height method for value box controllers (#1816)
1 parent ba3a4b2 commit 45699fa

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525

2626
* `shiny create` includes new and improved `ui.Chat()` template options. Most of these templates leverage the new [`{chatlas}` package](https://posit-dev.github.io/chatlas/), our opinionated approach to interfacing with various LLM. (#1806)
2727

28+
* Added a new `expect_max_height()` method to the Valuebox controllers to check the maximum height of a value box (#1816)
29+
2830
* Client data values (e.g., url info, output sizes/styles, etc.) can now be accessed in the server-side Python code via `session.clientdata`. For example, `session.clientdata.url_search()` reactively reads the URL search parameters. (#1832)
2931

3032
* Available `input` ids can now be listed via `dir(input)`. This also works on the new `session.clientdata` object. (#1832)
@@ -37,6 +39,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3739

3840
* `ui.Chat()` now correctly handles new `ollama.chat()` return value introduced in `ollama` v0.4. (#1787)
3941

42+
* Updated `expect_height()` for Valuebox controllers to check the height property instead of max-height. (#1816)
43+
4044
### Changes
4145

4246
* The Shiny Core component `shiny.ui.Chat()` no longer has a `.ui()` method. This method

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)