what-to-cook/test/empty-screen.test.js
Peppa b79a546b2a
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 1с
peppa/build build: success за 0с
ci / checks (pull_request) Successful in 4s
deploy / deploy (pull_request) Successful in 13s
WTC-39: скрыть «Полегче/Посложнее» на пустом списке
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 06:44:23 +05:00

20 lines
926 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
const read = (f) => readFileSync(new URL(`../src/${f}`, import.meta.url), "utf8");
test("Сценарий: на пустом списке «Полегче» и «Посложнее» скрыты", () => {
assert.match(read("app.js"), /\$\("tune"\)\.hidden = \$\("tuneInfo"\)\.hidden = n === 0/);
});
test("Сценарий: «Назад» только внутри карточки рецепта", () => {
const h = read("index.html");
const recipe = h.slice(h.indexOf('<article id="recipe"'));
const home = h.slice(0, h.indexOf('<article id="recipe"'));
assert.match(recipe, /id="back"/);
assert.doesNotMatch(home, /id="back"/);
});
test("Сценарий: [hidden] у блока кнопок действует", () => {
assert.match(read("style.css"), /\[hidden\]\s*\{\s*display:\s*none/);
});