Merge pull request 'TR-54: переключатель языка вверху страницы' (#52) from task/tr-54 into main

This commit is contained in:
peppa-bot 2026-11-16 14:07:34 +05:00
commit 4e0e3498a4
9 changed files with 10 additions and 6 deletions

View File

@ -29,6 +29,7 @@
- TR-34: замер в headless Chrome — сообщение о блокировке на 160–270 px от верха; `--window-size` не сужает окно меньше 500 px. Сообщение об ошибке стоит над полями, а не под формой (TR-21) — не переносить.
- TR-48: сообщение о блокировке — `<p class="error locked" role="alert">` (жёлтый фон, жирный, полоса слева; цвета `--lock-*` в src/views.ts), неверная пара — `class="error"` (розовый); заголовок к сообщению не добавлять (TR-21). `npm run screenshot:lockout` снимает три языка: docs/screenshots/lockout.png (ru), lockout-kk.png, lockout-en.png — все три показаны в памятке.
- TR-51: снимки сообщения о неверном пароле — docs/screenshots/wrong-password.png, -kk.png, -en.png (логин «proba», одна неверная попытка), показаны в памятке в разделе «Как проверить сообщения при входе»; снимает их та же `npm run screenshot:lockout`. Она переснимает и lockout*.png — если страница не менялась, верни их `git checkout`. Повтор задачи про сообщение при неверном пароле — уже закрыто, со снимком.
- TR-54: переключатель языка (`<nav>`) стоит НАД карточкой `<main>` в src/views.ts — в виде «таблеток», текущий язык залит акцентом; под формой по-прежнему только пустота (TR-47). Тесты проверяют `indexOf("<nav") < indexOf("<main")`. Менял вид — пересними `npm run screenshot:lockout`.
## Грабли

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -44,9 +44,12 @@ button, .button { display: block; width: 100%; padding: 12px; font: inherit; fon
text-align: center; text-decoration: none; color: var(--accent-text); background: var(--accent);
border: 0; border-radius: 8px; cursor: pointer; }
form { margin: 0; }
nav { display: flex; gap: 14px; font-size: 14px; color: var(--muted); }
nav a { color: var(--accent); }
nav [aria-current] { color: var(--text); font-weight: 600; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; max-width: 400px;
font-size: 15px; }
nav a { flex: 1 1 auto; min-width: 0; padding: 8px 14px; text-align: center; text-decoration: none;
color: var(--accent); background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
nav [aria-current] { color: var(--accent-text); background: var(--accent); border-color: var(--accent);
font-weight: 600; }
`;
interface PageOptions {
@ -77,10 +80,10 @@ function page({ lang, path, title, body, refreshSeconds }: PageOptions): string
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<nav aria-label="${escapeHtml(t(lang, "lang.label"))}">${switcher}</nav>
<main>
${body}
</main>
<nav aria-label="${escapeHtml(t(lang, "lang.label"))}">${switcher}</nav>
</body>
</html>
`;

View File

@ -651,7 +651,7 @@ describe("Requirement: Страница входа без пояснений п
app = await startApp();
const html = await (await app.get(`/login?lang=${lang}`)).text();
expect(html).toContain(`<html lang="${lang}">`);
expect(html.indexOf("<nav")).toBeGreaterThan(html.indexOf("</form>"));
expect(html.indexOf("<nav")).toBeLessThan(html.indexOf("<main"));
expect(textUnderForm(html)).toBe("");
expect(html).not.toContain('class="info"');
expect(html).not.toContain("<h2");
@ -750,7 +750,7 @@ describe("Requirement: Поля входа сразу под пояснение
expect(html).toContain(`<h1>${title}</h1>`);
expect(aboveFields(html).trim()).toBe(`<p class="lead">${lead}</p>`);
expect(html).toContain(`<button type="submit">${button}</button>\n</form>`);
expect(html.indexOf("<nav")).toBeGreaterThan(html.indexOf("</form>"));
expect(html.indexOf("<nav")).toBeLessThan(html.indexOf("<main"));
expect(textUnderForm(html)).toBe("");
},
);