diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e49f0c7b..b6fec1e10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `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) +* Added a new `expect_max_height()` method to the Valuebox controllers to check the maximum height of a value box (#1816) + * 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) * 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 * `ui.Chat()` now correctly handles new `ollama.chat()` return value introduced in `ollama` v0.4. (#1787) +* Updated `expect_height()` for Valuebox controllers to check the height property instead of max-height. (#1816) + ### Changes * The Shiny Core component `shiny.ui.Chat()` no longer has a `.ui()` method. This method diff --git a/shiny/playwright/controller/_card.py b/shiny/playwright/controller/_card.py index dda14507f..d00ac4b09 100644 --- a/shiny/playwright/controller/_card.py +++ b/shiny/playwright/controller/_card.py @@ -239,6 +239,21 @@ def expect_height(self, value: StyleValue, *, timeout: Timeout = None) -> None: timeout The maximum time to wait for the expectation to pass. Defaults to `None`. """ + _expect_style_to_have_value( + self.loc_container, "height", value, timeout=timeout + ) + + def expect_max_height(self, value: StyleValue, *, timeout: Timeout = None) -> None: + """ + Expects the value box to have a specific maximum height. + + Parameters + ---------- + value + The expected maximum height value. + timeout + The maximum time to wait for the expectation to pass. Defaults to `None`. + """ _expect_style_to_have_value( self.loc_container, "max-height", value, timeout=timeout ) diff --git a/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py b/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py index 67b855cce..08e4609f7 100644 --- a/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py +++ b/tests/playwright/shiny/components/value_box/kitchensink/test_valuebox_ks.py @@ -99,7 +99,7 @@ def test_valuebox(page: Page, local_app: ShinyAppProc) -> None: assert get_value_box_bg_color(value_box4) == "rgb(255, 255, 255)" value_box5 = controller.ValueBox(page, "valuebox5") - value_box5.expect_height("500px") + value_box5.expect_max_height("500px") assert get_title_tag_name(value_box5) == "p" value_box5.expect_title("No showcase w/ showcase layout") value_box5.expect_value("Red text - fill is False") diff --git a/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py b/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py index 4574cb5ff..88bec6bc2 100644 --- a/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py +++ b/tests/playwright/shiny/components/value_box/smoke/test_valuebox.py @@ -19,7 +19,8 @@ def test_valuebox(page: Page, local_app: ShinyAppProc, value_box_id: str) -> Non value_box.expect_value("$1 Billion Dollars") value_box.expect_body(["30% VS PREVIOUS 30 DAYS"]) else: - value_box.expect_height("500px") + value_box.expect_max_height("500px") + value_box.expect_height("300px") value_box.expect_title("title") value_box.expect_value("value") value_box.expect_body(["content", "more body"])