[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
2e3d0c151c
commit
f6b341bc70
2 changed files with 13 additions and 17 deletions
|
|
@ -38,7 +38,11 @@ def fail(m):
|
|||
raise AssertionError(f"[font-scale] FAIL: {m}")
|
||||
|
||||
|
||||
def near(a, b, tol = 0.35):
|
||||
def near(
|
||||
a,
|
||||
b,
|
||||
tol = 0.35,
|
||||
):
|
||||
return a is not None and b is not None and abs(a - b) <= tol
|
||||
|
||||
|
||||
|
|
@ -86,9 +90,7 @@ def open_appearance(page):
|
|||
page.wait_for_timeout(700)
|
||||
if page.get_by_role("dialog").count() == 0:
|
||||
fail("settings dialog did not open")
|
||||
page.get_by_role("dialog").get_by_role("button").filter(
|
||||
has_text = "Appearance"
|
||||
).first.click()
|
||||
page.get_by_role("dialog").get_by_role("button").filter(has_text = "Appearance").first.click()
|
||||
page.wait_for_timeout(600)
|
||||
|
||||
|
||||
|
|
@ -153,9 +155,7 @@ def main():
|
|||
page.wait_for_timeout(400)
|
||||
|
||||
step("overflowing select scrolls its Radix viewport")
|
||||
page.get_by_role("dialog").get_by_role("button").filter(
|
||||
has_text = "Voice"
|
||||
).first.click()
|
||||
page.get_by_role("dialog").get_by_role("button").filter(has_text = "Voice").first.click()
|
||||
page.wait_for_timeout(600)
|
||||
page.set_viewport_size({"width": 1440, "height": 480})
|
||||
page.locator("[aria-label='Dictation language']").click()
|
||||
|
|
@ -194,9 +194,7 @@ def main():
|
|||
page.wait_for_timeout(400)
|
||||
|
||||
step("default restores exactly")
|
||||
page.get_by_role("dialog").get_by_role("button").filter(
|
||||
has_text = "Appearance"
|
||||
).first.click()
|
||||
page.get_by_role("dialog").get_by_role("button").filter(has_text = "Appearance").first.click()
|
||||
page.wait_for_timeout(500)
|
||||
set_input(page, "UI font size", DEFAULT)
|
||||
final = measure(page)
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ from pathlib import Path
|
|||
REPO = Path(__file__).resolve().parents[2]
|
||||
SRC = REPO / "studio/frontend/src"
|
||||
INDEX_CSS = (SRC / "index.css").read_text(encoding = "utf-8")
|
||||
STORE = (SRC / "features/settings/stores/appearance-custom-store.ts").read_text(
|
||||
encoding = "utf-8"
|
||||
)
|
||||
STORE = (SRC / "features/settings/stores/appearance-custom-store.ts").read_text(encoding = "utf-8")
|
||||
SELECT = (SRC / "components/ui/select.tsx").read_text(encoding = "utf-8")
|
||||
|
||||
# Raw numeric fontSize props are only allowed where a scaled stylesheet rule
|
||||
|
|
@ -70,9 +68,7 @@ def test_ui_token_families_exist():
|
|||
|
||||
|
||||
def test_explicit_code_font_size_is_never_multiplied():
|
||||
match = re.search(
|
||||
r"html\[data-code-font-size\][^{]*\{([^}]*)\}", INDEX_CSS
|
||||
)
|
||||
match = re.search(r"html\[data-code-font-size\][^{]*\{([^}]*)\}", INDEX_CSS)
|
||||
assert match is not None
|
||||
body = match.group(1)
|
||||
assert "var(--custom-code-font-size)" in body
|
||||
|
|
@ -83,7 +79,9 @@ def test_radix_select_viewport_owns_the_scroll_state():
|
|||
viewport = SELECT[SELECT.index("SelectPrimitive.Viewport") :]
|
||||
assert "overflow-y-auto" in viewport.split("</SelectPrimitive.Viewport>")[0]
|
||||
# The rounded surface itself must not scroll (WebKit squares its corners).
|
||||
content_cls = re.search(r"SelectPrimitive\.Content[\s\S]*?className=\{cn\(\s*\"([^\"]+)\"", SELECT)
|
||||
content_cls = re.search(
|
||||
r"SelectPrimitive\.Content[\s\S]*?className=\{cn\(\s*\"([^\"]+)\"", SELECT
|
||||
)
|
||||
assert content_cls is not None
|
||||
assert "overflow-hidden" in content_cls.group(1)
|
||||
assert "overflow-y-auto" not in content_cls.group(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue