|
6 | 6 | from playwright.sync_api import expect as playwright_expect |
7 | 7 |
|
8 | 8 | from .._types import PatternOrStr, Timeout |
| 9 | +from ..expect._internal import ( |
| 10 | + expect_attribute_to_have_value as _expect_attribute_to_have_value, |
| 11 | +) |
9 | 12 | from ..expect._internal import expect_class_to_have_value as _expect_class_to_have_value |
10 | 13 | from ..expect._internal import expect_style_to_have_value as _expect_style_to_have_value |
11 | 14 | from ._base import UiWithContainer, WidthLocM |
@@ -131,6 +134,64 @@ def expect_bg_color(self, value: PatternOrStr, *, timeout: Timeout = None) -> No |
131 | 134 | self.loc_container, "--_sidebar-bg", value, timeout=timeout |
132 | 135 | ) |
133 | 136 |
|
| 137 | + def expect_desktop_state( |
| 138 | + self, value: Literal["open", "closed", "always"], *, timeout: Timeout = None |
| 139 | + ) -> None: |
| 140 | + """ |
| 141 | + Asserts that the sidebar has the expected state on desktop. |
| 142 | +
|
| 143 | + Parameters |
| 144 | + ---------- |
| 145 | + value |
| 146 | + The expected state of the sidebar on desktop. |
| 147 | + timeout |
| 148 | + The maximum time to wait for the state to appear. Defaults to `None`. |
| 149 | + """ |
| 150 | + _expect_attribute_to_have_value( |
| 151 | + self.loc_container, |
| 152 | + name="data-open-desktop", |
| 153 | + value=value, |
| 154 | + timeout=timeout, |
| 155 | + ) |
| 156 | + |
| 157 | + def expect_mobile_state( |
| 158 | + self, value: Literal["open", "closed", "always"], *, timeout: Timeout = None |
| 159 | + ) -> None: |
| 160 | + """ |
| 161 | + Asserts that the sidebar has the expected state on mobile. |
| 162 | +
|
| 163 | + Parameters |
| 164 | + ---------- |
| 165 | + value |
| 166 | + The expected state of the sidebar on mobile. |
| 167 | + timeout |
| 168 | + The maximum time to wait for the state to appear. Defaults to `None`. |
| 169 | + """ |
| 170 | + _expect_attribute_to_have_value( |
| 171 | + self.loc_container, |
| 172 | + name="data-open-mobile", |
| 173 | + value=value, |
| 174 | + timeout=timeout, |
| 175 | + ) |
| 176 | + |
| 177 | + def expect_mobile_max_height( |
| 178 | + self, value: PatternOrStr, *, timeout: Timeout = None |
| 179 | + ) -> None: |
| 180 | + """ |
| 181 | + Asserts that the sidebar has the expected maximum height on mobile. |
| 182 | +
|
| 183 | + Parameters |
| 184 | + ---------- |
| 185 | + value |
| 186 | + The expected maximum height of the sidebar on mobile. |
| 187 | + timeout |
| 188 | + The maximum time to wait for the maximum height to appear. Defaults to `None`. |
| 189 | + """ |
| 190 | + self.expect_mobile_state("always", timeout=timeout) |
| 191 | + _expect_style_to_have_value( |
| 192 | + self.loc_container, "--_mobile-max-height", value, timeout=timeout |
| 193 | + ) |
| 194 | + |
134 | 195 | def expect_title(self, value: PatternOrStr, *, timeout: Timeout = None) -> None: |
135 | 196 | """ |
136 | 197 | Asserts that the sidebar has the expected title. |
|
0 commit comments