from pathlib import Path from tests.helpers.stylesheets import app_css STYLE_CSS_TEXT = app_css() def _style_text() -> str: return STYLE_CSS_TEXT def test_native_select_options_use_theme_tokens(): css = _style_text() assert "--select-option-bg:" in css assert "--select-option-fg:" in css assert "--select-option-active-bg:" in css assert "select option,\n select optgroup" in css assert "background-color: var(--select-option-bg);" in css assert "color: var(--select-option-fg);" in css assert "select option:checked" in css assert "background-color: var(--select-option-active-bg);" in css def test_light_theme_keeps_native_selects_light(): css = _style_text() light_theme_start = css.index(":root.light {") light_theme_end = css.index("}", light_theme_start) light_theme_block = css[light_theme_start:light_theme_end] assert "--select-bg: #eaeaea;" in light_theme_block assert "--select-option-bg: var(--panel);" in light_theme_block assert ":root.light select { color-scheme: light; }" in css