|
2 | 2 |
|
3 | 3 | pytest.importorskip('playwright') |
4 | 4 |
|
| 5 | +from panel import Column |
5 | 6 | from panel.tests.util import serve_component, wait_until |
6 | | -from panel_material_ui.widgets import MultiSelect, Select |
| 7 | +from panel_material_ui.widgets import MultiSelect, NestedSelect, Select |
7 | 8 | from playwright.sync_api import expect |
8 | 9 |
|
9 | 10 | pytestmark = pytest.mark.ui |
@@ -180,6 +181,25 @@ def test_select_clear_selection(page): |
180 | 181 | page.locator(".select").click() |
181 | 182 | expect(page.locator(".MuiMenuItem-root")).to_have_count(2) # No empty option |
182 | 183 |
|
| 184 | +def test_nestedselect_stretch_width(page): |
| 185 | + widget = NestedSelect(options={"a": [1, 2]}, sizing_mode="stretch_width") |
| 186 | + serve_component(page, Column(widget, width=600)) |
| 187 | + |
| 188 | + select = page.locator(".select").first |
| 189 | + assert select.bounding_box()["width"] > 500 |
| 190 | + |
| 191 | + |
| 192 | +def test_nestedselect_level_width_overrides_stretch(page): |
| 193 | + widget = NestedSelect( |
| 194 | + options={"a": [1, 2]}, |
| 195 | + levels=[{"width": 150}, {}], |
| 196 | + sizing_mode="stretch_width", |
| 197 | + ) |
| 198 | + serve_component(page, Column(widget, width=600)) |
| 199 | + |
| 200 | + assert page.locator(".select").first.bounding_box()["width"] < 200 |
| 201 | + |
| 202 | + |
183 | 203 | def test_multiselect_focus(page): |
184 | 204 | widget = MultiSelect(options=["Option 1", "Option 2", "Option 3"], value=["Option 1"]) |
185 | 205 | serve_component(page, widget) |
|
0 commit comments