19 lines
1.1 KiB
JavaScript
19 lines
1.1 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import {readFileSync} from "node:fs";
|
|
import test from "node:test";
|
|
import {createElement} from "react";
|
|
import {renderToStaticMarkup} from "react-dom/server";
|
|
import {StatusBadge} from "../packages/ui-react/dist/index.js";
|
|
|
|
test("status pulse is opt-in and does not replace the status text",()=>{
|
|
const status=renderToStaticMarkup(createElement(StatusBadge,{tone:"danger",pulse:true},"Привязка потеряна"));
|
|
assert.match(status,/data-pulse="true"/);
|
|
assert.match(status,/Привязка потеряна/);
|
|
assert.doesNotMatch(renderToStaticMarkup(createElement(StatusBadge,{},"Готово")),/data-pulse/);
|
|
});
|
|
test("only the lamp animates, with static reduced-motion fallback",()=>{
|
|
const css=readFileSync(new URL("../packages/ui-core/styles.css",import.meta.url),"utf8");
|
|
assert.match(css,/\.nodedc-status\[data-pulse="true"\]::before\s*\{[^}]*animation: nodedc-status-pulse/);
|
|
assert.match(css,/@media \(prefers-reduced-motion: reduce\) \{\s*\.nodedc-status\[data-pulse="true"\]::before \{ animation: none;/);
|
|
});
|