B-248: 收口登录错误态、焦点与桌面总宽
This commit is contained in:
@@ -40,6 +40,8 @@ class LoginFrontendContractTests(unittest.TestCase):
|
||||
|
||||
def test_login_css_lives_in_one_section(self) -> None:
|
||||
self.assertIn("minmax(460px, 520px)", self.css)
|
||||
self.assertIn("max-width: 1180px", self.css)
|
||||
self.assertIn("margin: 0 auto", self.css)
|
||||
self.assertIn("width: min(440px, 100%)", self.css)
|
||||
self.assertIn("@media (max-width: 1023px)", self.css)
|
||||
self.assertIn("@media (max-width: 720px)", self.css)
|
||||
@@ -55,6 +57,13 @@ class LoginFrontendContractTests(unittest.TestCase):
|
||||
self.assertNotIn(".entry-form {", later)
|
||||
self.assertNotIn(".role-switch {", later)
|
||||
|
||||
def test_login_error_and_keyboard_focus_follow_tokens(self) -> None:
|
||||
self.assertIn(".entry-form #loginError { color: var(--color-danger); }", self.css)
|
||||
self.assertIn(
|
||||
".entry-form .field input:focus-visible { outline: 2px solid var(--color-primary-strong); outline-offset: 3px; }",
|
||||
self.css,
|
||||
)
|
||||
|
||||
def test_role_switch_reuses_segmented_rhythm(self) -> None:
|
||||
self.assertIn(".role-switch { display: flex; gap: 4px; padding: 4px;", self.css)
|
||||
self.assertIn("min-height: 36px", self.css)
|
||||
|
||||
@@ -43,6 +43,7 @@ MEASURE = r"""
|
||||
if (dx <= 0 || dy <= 0) return 0;
|
||||
return Math.round(dx * dy);
|
||||
};
|
||||
const shell = document.querySelector(".entry-shell");
|
||||
const context = document.querySelector(".entry-context");
|
||||
const wrap = document.querySelector(".entry-form-wrap");
|
||||
const form = document.querySelector(".entry-form");
|
||||
@@ -51,6 +52,7 @@ MEASURE = r"""
|
||||
const brand = document.querySelector("#product-name");
|
||||
const status = document.querySelector(".entry-status");
|
||||
const statement = document.querySelector(".entry-statement h1");
|
||||
const sh = box(shell);
|
||||
const ctx = box(context);
|
||||
const wr = box(wrap);
|
||||
const fm = box(form);
|
||||
@@ -59,7 +61,9 @@ MEASURE = r"""
|
||||
return {
|
||||
viewport: window.innerWidth,
|
||||
viewportH: window.innerHeight,
|
||||
grid: getComputedStyle(document.querySelector(".entry-shell")).gridTemplateColumns,
|
||||
grid: getComputedStyle(shell).gridTemplateColumns,
|
||||
shellBox: sh,
|
||||
shellCentered: Boolean(sh && Math.abs((sh.left + sh.right) / 2 - window.innerWidth / 2) <= 1),
|
||||
contextBox: ctx,
|
||||
wrapBox: wr,
|
||||
formBox: fm,
|
||||
@@ -204,6 +208,8 @@ class LoginLayoutTests(unittest.TestCase):
|
||||
self.assertTrue(metrics["changeHidden"], metrics)
|
||||
if mode == "desktop":
|
||||
self.assertTrue(metrics["dualZone"], metrics)
|
||||
self.assertLessEqual(metrics["shellBox"]["width"], 1180, metrics)
|
||||
self.assertTrue(metrics["shellCentered"], metrics)
|
||||
self.assertFalse(metrics["stacked"], metrics)
|
||||
self.assertGreaterEqual(metrics["formWidth"], 420, metrics)
|
||||
self.assertLessEqual(metrics["formWidth"], 460, metrics)
|
||||
|
||||
Reference in New Issue
Block a user