Add forced-colors support and contrast guidance
CI / Test and package (push) Failing after 49s

This commit is contained in:
2026-11-21 02:24:44 +01:00
parent db683819c9
commit 5e93a89b3a
15 changed files with 192 additions and 13 deletions
+1
View File
@@ -8,6 +8,7 @@
- Added semantic link, code, disabled, font-size, and breakpoint tokens. - Added semantic link, code, disabled, font-size, and breakpoint tokens.
- Expanded the example page and validation checks for the public API. - Expanded the example page and validation checks for the public API.
- Added a generated public API manifest, breaking-change detection, release metadata validation, and isolated tarball consumer tests. - Added a generated public API manifest, breaking-change detection, release metadata validation, and isolated tarball consumer tests.
- Added forced-colors support with system-color mappings, non-color state cues, catalog guidance, and component-level Playwright regressions.
## 0.4.0 ## 0.4.0
+8 -2
View File
@@ -6,7 +6,7 @@ Frost ist eine kleine CSS-Basis für persönliche Websites und Web-Apps. Sie bri
Der interaktive [Komponentenkatalog](examples/index.html) zeigt die öffentliche Komponenten-API mit echten Live-Beispielen, kopierbarem HTML und konkreten Accessibility-Hinweisen. Suche und Theme-Wechsel funktionieren direkt im Browser; Dropdowns, Tabs, Accordions und Modals demonstrieren das erwartete Tastatur- und Fokusverhalten. Der interaktive [Komponentenkatalog](examples/index.html) zeigt die öffentliche Komponenten-API mit echten Live-Beispielen, kopierbarem HTML und konkreten Accessibility-Hinweisen. Suche und Theme-Wechsel funktionieren direkt im Browser; Dropdowns, Tabs, Accordions und Modals demonstrieren das erwartete Tastatur- und Fokusverhalten.
Die visuellen Regressionstests erzeugen für jede Komponentengruppe eigene Referenzbilder in heller und dunkler Darstellung sowie für Desktop- und Mobile-Viewports. Dadurch lässt sich eine Änderung einer konkreten Gruppe zuordnen, ohne eine vollständige Galerieseite vergleichen zu müssen. Die visuellen Regressionstests erzeugen für jede Komponentengruppe eigene Referenzbilder in heller, dunkler und erzwungener Systemfarb-Darstellung sowie für Desktop- und Mobile-Viewports. Dadurch lässt sich eine Änderung einer konkreten Gruppe zuordnen, ohne eine vollständige Galerieseite vergleichen zu müssen.
## Einbinden ## Einbinden
@@ -160,6 +160,12 @@ oder:
Frost braucht kein JavaScript. Ein Theme-Schalter kann später mit Iceberg oder ganz normalem Vanilla-JavaScript ergänzt werden. Frost braucht kein JavaScript. Ein Theme-Schalter kann später mit Iceberg oder ganz normalem Vanilla-JavaScript ergänzt werden.
Bei `forced-colors: active` hat das Betriebssystem Vorrang vor hellen, dunklen und benutzerdefinierten Themes. Frost bildet Flächen und Text auf `Canvas`/`CanvasText`, Controls auf `ButtonFace`/`ButtonText`, Links auf `LinkText`, Auswahl und Fokus auf `Highlight`/`HighlightText` sowie deaktivierte Inhalte auf `GrayText` ab. Fehler, Warnungen, Erfolg, Auswahl und aktive Zustände unterscheiden sich zusätzlich über Rahmenstil, Rahmenbreite oder Unterstreichung und sind damit nicht ausschließlich farbabhängig.
Bei `prefers-contrast: more` ohne Forced Colors verstärkt Frost Control- und Flächenrahmen, Fokus, Auswahl und Validierungszustände und hebt gedämpften Text auf die normale Textfarbe an. Benutzerdefinierte Theme-Farben bleiben in diesem Modus erhalten.
Eigene Erweiterungen sollten die automatische Anpassung bevorzugen. `forced-color-adjust: none` ist nur sinnvoll, wenn die Komponente anschließend vollständig mit Systemfarben definiert wird. Der [Komponentenkatalog](examples/index.html) zeigt die Palette und die erwarteten Zustände live.
Wenn ein Projekt weitere Themes braucht, sollten die semantischen Rollen von Frost überschrieben werden – nicht die Component-Selektoren: Wenn ein Projekt weitere Themes braucht, sollten die semantischen Rollen von Frost überschrieben werden – nicht die Component-Selektoren:
```css ```css
@@ -281,7 +287,7 @@ npx playwright install chromium
npm run test:browser npm run test:browser
``` ```
Die Suite prüft Desktop- und Mobile-Ansichten, helle und dunkle Themes, Tastaturinteraktionen und WCAG-A/AA-Regeln. Absichtliche visuelle Änderungen aktualisieren die gespeicherten Referenzbilder mit: Die Suite prüft Desktop- und Mobile-Ansichten, helle und dunkle Themes, Forced Colors, Tastaturinteraktionen und WCAG-A/AA-Regeln. Die Forced-Colors-Fälle kontrollieren zusätzlich Systemfarb-Mappings sowie sichtbare Fokus-, Fehler-, Auswahl- und Disabled-Zustände. Absichtliche visuelle Änderungen aktualisieren die gespeicherten Referenzbilder mit:
```bash ```bash
npm run test:browser:update npm run test:browser:update
+1 -1
View File
@@ -1,4 +1,4 @@
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components; @layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.forced-colors;
@import url("./core.css"); @import url("./core.css");
@import url("./layout.css") layer(frost.layout); @import url("./layout.css") layer(frost.layout);
+2 -1
View File
@@ -1,5 +1,6 @@
@layer frost.tokens, frost.base, frost.accessibility; @layer frost.tokens, frost.base, frost.accessibility, frost.forced-colors;
@import url("./tokens.css") layer(frost.tokens); @import url("./tokens.css") layer(frost.tokens);
@import url("./base.css") layer(frost.base); @import url("./base.css") layer(frost.base);
@import url("./accessibility.css") layer(frost.accessibility); @import url("./accessibility.css") layer(frost.accessibility);
@import url("./forced-colors.css");
+76
View File
@@ -126,6 +126,41 @@
.catalog-hero__meta { align-items: center; } .catalog-hero__meta { align-items: center; }
.catalog-contrast-guide {
display: grid;
grid-template-columns: minmax(0, 1.2fr) minmax(14rem, 0.8fr);
gap: var(--frost-space-5) var(--frost-space-8);
margin-block: var(--frost-space-8) 0;
border-color: color-mix(in srgb, var(--frost-color-accent) 42%, var(--frost-color-border));
}
.catalog-contrast-guide h2 { margin: 0 0 var(--frost-space-3); font-size: var(--frost-font-size-xl); }
.catalog-contrast-guide p:not(.catalog-eyebrow) { margin: 0; color: var(--frost-color-text-muted); }
.catalog-contrast-guide ul { grid-column: 1 / -1; display: grid; gap: var(--frost-space-2); margin: 0; padding-inline-start: var(--frost-space-5); color: var(--frost-color-text-muted); }
.catalog-system-colors {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--frost-space-2);
align-self: start;
}
.catalog-system-color {
display: grid;
min-height: 3.5rem;
place-items: center;
padding: var(--frost-space-2);
border: 1px solid var(--frost-color-border-strong);
border-radius: var(--frost-radius-sm);
font-size: 0.75rem;
font-weight: 750;
}
.catalog-system-color--canvas { background: var(--frost-color-surface); color: var(--frost-color-text); }
.catalog-system-color--text { background: var(--frost-color-text); color: var(--frost-color-bg); }
.catalog-system-color--button { background: var(--frost-color-surface-soft); color: var(--frost-color-text); }
.catalog-system-color--highlight { background: var(--frost-color-accent); color: var(--frost-color-on-accent); }
.catalog-empty { .catalog-empty {
padding: var(--frost-space-8); padding: var(--frost-space-8);
border: 1px dashed var(--frost-color-border-strong); border: 1px dashed var(--frost-color-border-strong);
@@ -286,6 +321,7 @@
@media (max-width: 48rem) { @media (max-width: 48rem) {
.catalog-hero, .catalog-hero,
.catalog-contrast-guide,
.catalog-component__header, .catalog-component__header,
.catalog-details { grid-template-columns: 1fr; } .catalog-details { grid-template-columns: 1fr; }
.catalog-hero__actions { justify-self: start; } .catalog-hero__actions { justify-self: start; }
@@ -293,4 +329,44 @@
.catalog-demo-grid { grid-template-columns: 1fr; } .catalog-demo-grid { grid-template-columns: 1fr; }
.catalog-component__header { padding: var(--frost-space-5); } .catalog-component__header { padding: var(--frost-space-5); }
} }
@media (forced-colors: active) {
.catalog-sidebar,
.catalog-hero,
.catalog-contrast-guide,
.catalog-component,
.catalog-component__header,
.catalog-code,
.catalog-code__toolbar,
.catalog-a11y {
border-color: CanvasText;
background: Canvas;
color: CanvasText;
box-shadow: none;
}
.catalog-hero { background-image: none; }
.catalog-brand__mark { border: 1px solid Highlight; background: Highlight; color: HighlightText; forced-color-adjust: none; }
.catalog-eyebrow,
.catalog-hero__copy,
.catalog-sidebar__intro,
.catalog-nav__label,
.catalog-component__header p,
.catalog-live__label,
.catalog-a11y ul,
.catalog-contrast-guide p:not(.catalog-eyebrow),
.catalog-contrast-guide ul { color: CanvasText; }
.catalog-nav__link { color: LinkText; }
.catalog-nav__link:hover,
.catalog-nav__link:focus-visible { background: Highlight; color: HighlightText; forced-color-adjust: none; }
.catalog-live { background: Canvas; }
.catalog-copy { border-color: ButtonText; background: ButtonFace; color: ButtonText; forced-color-adjust: none; }
.catalog-copy:hover { background: Highlight; color: HighlightText; }
.catalog-code pre { background: Canvas; color: CanvasText; forced-color-adjust: none; }
.catalog-system-color { border-color: CanvasText; forced-color-adjust: none; }
.catalog-system-color--canvas { background: Canvas; color: CanvasText; }
.catalog-system-color--text { background: CanvasText; color: Canvas; }
.catalog-system-color--button { background: ButtonFace; color: ButtonText; }
.catalog-system-color--highlight { background: Highlight; color: HighlightText; }
}
} }
+5
View File
@@ -103,6 +103,11 @@
<div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Bevorzuge das native <code>dialog</code>-Element und öffne es mit <code>showModal()</code>.</li><li>Verbinde den Dialog über <code>aria-labelledby</code> mit einer sichtbaren Überschrift.</li><li>Nach dem Schließen kehrt der Fokus zum auslösenden Button zurück.</li></ul></aside></div> <div class="catalog-details"><div class="catalog-code"><div class="catalog-code__toolbar"><span>HTML</span><button class="catalog-copy" type="button" data-copy-html>HTML kopieren</button></div><pre tabindex="0"><code data-snippet-code></code></pre></div><aside class="catalog-a11y"><h3>Accessibility</h3><ul><li>Bevorzuge das native <code>dialog</code>-Element und öffne es mit <code>showModal()</code>.</li><li>Verbinde den Dialog über <code>aria-labelledby</code> mit einer sichtbaren Überschrift.</li><li>Nach dem Schließen kehrt der Fokus zum auslösenden Button zurück.</li></ul></aside></div>
</section> </section>
</div> </div>
<aside class="catalog-contrast-guide frost-card" aria-labelledby="contrast-guide-title">
<div><p class="catalog-eyebrow">Forced Colors</p><h2 id="contrast-guide-title">Hoher Kontrast gehört zum Komponentenvertrag.</h2><p>Frost ordnet Flächen, Text, Controls, Links, Auswahl und deaktivierte Zustände den Systemfarben zu. Windows Contrast Themes und andere Forced-Colors-Umgebungen bleiben dadurch vollständig unter Kontrolle der Nutzenden.</p></div>
<div class="catalog-system-colors" aria-label="Verwendete Systemfarben"><span class="catalog-system-color catalog-system-color--canvas">Canvas</span><span class="catalog-system-color catalog-system-color--text">CanvasText</span><span class="catalog-system-color catalog-system-color--button">ButtonFace</span><span class="catalog-system-color catalog-system-color--highlight">Highlight</span></div>
<ul><li>Status nie nur über Farbe vermitteln; Frost ergänzt Unterschiede durch Rahmenstile und sichtbare Beschriftungen.</li><li>Eigene Komponenten sollten <code>forced-color-adjust: none</code> nur zusammen mit Systemfarben einsetzen.</li><li>Fokus, Auswahl, Fehler und deaktivierte Controls mit <code>forced-colors</code> und <code>prefers-contrast: more</code> prüfen.</li></ul>
</aside>
<footer class="catalog-footer">Frost bleibt CSS-only. Das Katalog-Script demonstriert ausschließlich Theme-, Copy- und zugängliches Interaktionsverhalten.</footer> <footer class="catalog-footer">Frost bleibt CSS-only. Das Katalog-Script demonstriert ausschließlich Theme-, Copy- und zugängliches Interaktionsverhalten.</footer>
</main> </main>
</div> </div>
+1 -1
View File
@@ -1,4 +1,4 @@
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.utilities; @layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.controls, frost.components, frost.utilities, frost.forced-colors;
@import url("./core.css"); @import url("./core.css");
@import url("./layout.css") layer(frost.layout); @import url("./layout.css") layer(frost.layout);
+2
View File
@@ -12,6 +12,7 @@
"./tokens.css": "./tokens.css", "./tokens.css": "./tokens.css",
"./base.css": "./base.css", "./base.css": "./base.css",
"./accessibility.css": "./accessibility.css", "./accessibility.css": "./accessibility.css",
"./forced-colors.css": "./forced-colors.css",
"./layout.css": "./layout.css", "./layout.css": "./layout.css",
"./controls.css": "./controls.css", "./controls.css": "./controls.css",
"./components.css": "./components.css", "./components.css": "./components.css",
@@ -23,6 +24,7 @@
"./components": "./components.css", "./components": "./components.css",
"./utilities": "./utilities.css", "./utilities": "./utilities.css",
"./tokens": "./tokens.css", "./tokens": "./tokens.css",
"./forced-colors": "./forced-colors.css",
"./public-api.json": "./public-api.json", "./public-api.json": "./public-api.json",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
+4 -1
View File
@@ -569,7 +569,8 @@
"frost.layout", "frost.layout",
"frost.controls", "frost.controls",
"frost.components", "frost.components",
"frost.utilities" "frost.utilities",
"frost.forced-colors"
], ],
"exports": { "exports": {
".": "./frost.css", ".": "./frost.css",
@@ -583,6 +584,8 @@
"./controls.css": "./controls.css", "./controls.css": "./controls.css",
"./core": "./core.css", "./core": "./core.css",
"./core.css": "./core.css", "./core.css": "./core.css",
"./forced-colors": "./forced-colors.css",
"./forced-colors.css": "./forced-colors.css",
"./frost.css": "./frost.css", "./frost.css": "./frost.css",
"./layout.css": "./layout.css", "./layout.css": "./layout.css",
"./package.json": "./package.json", "./package.json": "./package.json",
+3 -3
View File
@@ -5,9 +5,9 @@ import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url)); const root = fileURLToPath(new URL("..", import.meta.url));
const output = resolve(root, "dist"); const output = resolve(root, "dist");
const layers = { const layers = {
"frost.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css"], "frost.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css", "forced-colors.css"],
"utility-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "utilities.css"], "utility-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "utilities.css", "forced-colors.css"],
"component-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css"], "component-layer.css": ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "forced-colors.css"],
}; };
const minify = (source) => source const minify = (source) => source
+5 -1
View File
@@ -11,6 +11,7 @@ const cssFiles = [
"tokens.css", "tokens.css",
"base.css", "base.css",
"accessibility.css", "accessibility.css",
"forced-colors.css",
"layout.css", "layout.css",
"controls.css", "controls.css",
"components.css", "components.css",
@@ -35,7 +36,7 @@ for (const match of entry.matchAll(/@import\s+url\("([^"]+)"\)/g)) {
} }
const layerSources = { const layerSources = {
"core.css": ["tokens.css", "base.css", "accessibility.css"], "core.css": ["tokens.css", "base.css", "accessibility.css", "forced-colors.css"],
"utility-layer.css": ["core.css", "layout.css", "utilities.css"], "utility-layer.css": ["core.css", "layout.css", "utilities.css"],
"component-layer.css": ["core.css", "layout.css", "controls.css", "components.css"], "component-layer.css": ["core.css", "layout.css", "controls.css", "components.css"],
}; };
@@ -67,6 +68,9 @@ for (const exportPath of ["./utilities", "./components", "./tokens"]) {
for (const exportPath of ["./core", "./utility-layer", "./component-layer"]) { for (const exportPath of ["./core", "./utility-layer", "./component-layer"]) {
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing layer export ${exportPath}`); if (!packageJson.exports[exportPath]) errors.push(`package.json: missing layer export ${exportPath}`);
} }
for (const exportPath of ["./forced-colors", "./forced-colors.css"]) {
if (!packageJson.exports[exportPath]) errors.push(`package.json: missing forced-colors export ${exportPath}`);
}
if (errors.length) { if (errors.length) {
console.error(errors.join("\n")); console.error(errors.join("\n"));
+1 -1
View File
@@ -4,7 +4,7 @@ import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url)); const root = fileURLToPath(new URL("..", import.meta.url));
const manifestPath = resolve(root, "public-api.json"); const manifestPath = resolve(root, "public-api.json");
const cssFiles = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css"]; const cssFiles = ["tokens.css", "base.css", "accessibility.css", "forced-colors.css", "layout.css", "controls.css", "components.css", "utilities.css"];
const sortLexically = (values) => [...values].sort((left, right) => left < right ? -1 : left > right ? 1 : 0); const sortLexically = (values) => [...values].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8")); const packageJson = JSON.parse(await readFile(resolve(root, "package.json"), "utf8"));
+1 -1
View File
@@ -4,7 +4,7 @@ import { resolve } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
const root = fileURLToPath(new URL("..", import.meta.url)); const root = fileURLToPath(new URL("..", import.meta.url));
const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css"]; const files = ["tokens.css", "base.css", "accessibility.css", "layout.css", "controls.css", "components.css", "utilities.css", "forced-colors.css"];
const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n"); const source = (await Promise.all(files.map((file) => readFile(resolve(root, file), "utf8")))).join("\n");
const rawBytes = Buffer.byteLength(source); const rawBytes = Buffer.byteLength(source);
const gzipBytes = gzipSync(source).byteLength; const gzipBytes = gzipSync(source).byteLength;
+81
View File
@@ -20,6 +20,7 @@ test.beforeEach(async ({ page }) => {
}); });
const visualCases = [ const visualCases = [
{ id: "contrast-guide", name: "forced-colors guidance", target: ".catalog-contrast-guide" },
{ id: "buttons", name: "buttons" }, { id: "buttons", name: "buttons" },
{ id: "forms", name: "form controls" }, { id: "forms", name: "form controls" },
{ id: "surfaces", name: "surfaces and badges" }, { id: "surfaces", name: "surfaces and badges" },
@@ -47,6 +48,14 @@ for (const visualCase of visualCases) {
await expect(target).toHaveScreenshot(`component-${visualCase.id}-${theme}.png`); await expect(target).toHaveScreenshot(`component-${visualCase.id}-${theme}.png`);
} }
}); });
test(`${visualCase.name} matches its forced-colors baseline`, async ({ page }) => {
await page.emulateMedia({ colorScheme: "light", forcedColors: "active" });
await page.addStyleTag({ content: ".frost-skip-link { display: none !important; }" });
await visualCase.prepare?.(page);
const target = page.locator(visualCase.target ?? `#${visualCase.id}`);
await expect(target).toHaveScreenshot(`component-${visualCase.id}-forced-colors.png`);
});
} }
for (const theme of ["light", "dark"]) { for (const theme of ["light", "dark"]) {
@@ -139,3 +148,75 @@ test("modal restores focus to its trigger after closing", async ({ page }) => {
await expect(trigger).toBeFocused(); await expect(trigger).toBeFocused();
}); });
test("forced colors preserves system mappings and non-color state cues", async ({ page }) => {
await page.emulateMedia({ colorScheme: "light", forcedColors: "active" });
const primary = page.locator("#buttons .frost-button--primary").first();
const disabled = page.locator("#buttons .frost-button:disabled");
const invalid = page.locator("#forms [aria-invalid='true']");
const selectedTab = page.locator("#disclosure [role='tab'][aria-selected='true']");
await primary.focus();
await expect(primary).toBeFocused();
const states = await page.evaluate(() => {
const style = (selector) => getComputedStyle(document.querySelector(selector));
const primaryStyle = style("#buttons .frost-button--primary");
const disabledStyle = style("#buttons .frost-button:disabled");
const invalidStyle = style("#forms [aria-invalid='true']");
const selectedStyle = style("#disclosure [role='tab'][aria-selected='true']");
const interactiveCardStyle = style("#surfaces .frost-card--interactive");
return {
primary: {
forcedColorAdjust: primaryStyle.forcedColorAdjust,
outlineStyle: primaryStyle.outlineStyle,
outlineWidth: Number.parseFloat(primaryStyle.outlineWidth),
},
disabled: { opacity: disabledStyle.opacity },
invalid: { borderStyle: invalidStyle.borderStyle, borderWidth: Number.parseFloat(invalidStyle.borderWidth) },
selected: { borderStyle: selectedStyle.borderBottomStyle, borderWidth: Number.parseFloat(selectedStyle.borderBottomWidth) },
card: { boxShadow: interactiveCardStyle.boxShadow },
};
});
expect(states.primary.forcedColorAdjust).toBe("none");
expect(states.primary.outlineStyle).toBe("solid");
expect(states.primary.outlineWidth).toBeGreaterThanOrEqual(3);
expect(states.disabled.opacity).toBe("1");
expect(states.invalid.borderStyle).toBe("dashed");
expect(states.invalid.borderWidth).toBeGreaterThanOrEqual(2);
expect(states.selected.borderStyle).toBe("solid");
expect(states.selected.borderWidth).toBeGreaterThanOrEqual(3);
expect(states.card.boxShadow).toBe("none");
await expect(disabled).toBeDisabled();
await expect(invalid).toHaveAttribute("aria-invalid", "true");
await expect(selectedTab).toHaveAttribute("aria-selected", "true");
});
test("increased contrast strengthens component boundaries and states", async ({ page }) => {
await page.emulateMedia({ colorScheme: "light", contrast: "more", forcedColors: "none" });
const states = await page.evaluate(() => {
const style = (selector) => getComputedStyle(document.querySelector(selector));
const buttonStyle = style("#buttons .frost-button--primary");
const disabledStyle = style("#buttons .frost-button:disabled");
const invalidStyle = style("#forms [aria-invalid='true']");
const cardStyle = style("#surfaces .frost-card");
const selectedStyle = style("#disclosure [role='tab'][aria-selected='true']");
return {
buttonBorderWidth: Number.parseFloat(buttonStyle.borderWidth),
disabled: { borderStyle: disabledStyle.borderStyle, opacity: disabledStyle.opacity },
invalidBorderStyle: invalidStyle.borderStyle,
cardBorderWidth: Number.parseFloat(cardStyle.borderWidth),
selectedBorderWidth: Number.parseFloat(selectedStyle.borderBottomWidth),
};
});
expect(states.buttonBorderWidth).toBeGreaterThanOrEqual(2);
expect(states.disabled).toEqual({ borderStyle: "dotted", opacity: "1" });
expect(states.invalidBorderStyle).toBe("dashed");
expect(states.cardBorderWidth).toBeGreaterThanOrEqual(2);
expect(states.selectedBorderWidth).toBeGreaterThanOrEqual(3);
});
+1 -1
View File
@@ -1,4 +1,4 @@
@layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.utilities; @layer frost.tokens, frost.base, frost.accessibility, frost.layout, frost.utilities, frost.forced-colors;
@import url("./core.css"); @import url("./core.css");
@import url("./layout.css") layer(frost.layout); @import url("./layout.css") layer(frost.layout);