mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
fix: close review gaps in host-control fonts, on-accent contrast and protected filter values
- Host-owned controls refuse font tokens naming the compiler's scoped skin font prefix (ws-), so a skin @font-face gated behind a non-matching @media (absent from document.fonts) cannot blank labels after a resize; the theme binding also re-reads tokens on viewport resize for @media-scoped tokens. - A token palette is accepted only if black or white text reaches 4.5:1 on its accent; mid-tone accents (~4.23:1) now fall back as a group. - Protected app-DOM controls reject var()/attr() for filter, clip and content-visibility, which could smuggle opacity(0)/rect(0,0,0,0)/hidden past the literal hide checks; literal filters and other parts are unchanged. - Docs and tests updated (unit + headless-Chrome fixture).
This commit is contained in:
1 parent
a353c32892
commit
0df25e4892
7 files changed
+92
-15
No files matched your search
+16
@@ -61,6 +61,22 @@ const addSkinStyle = (css) => {
|
||||
await frames();
|
||||
results.push(snap("system-font"));
|
||||
|
||||
// A compiled skin face behind a non-matching @media is absent from
|
||||
// document.fonts; its scoped `ws-` name must still be refused.
|
||||
addSkinStyle(`@media (max-width: 1px) { @font-face { font-family: "ws-community-theme-fixture-blank"; src: url(data:font/woff2;base64,AAAA); } }
|
||||
.ws-skin-root { --skin-host-font: "ws-community-theme-fixture-blank", sans-serif; }`);
|
||||
await frames();
|
||||
results.push(snap("media-gated-skin-font"));
|
||||
|
||||
// Tokens declared inside @media follow the viewport without a DOM change.
|
||||
const viewportStyle = addSkinStyle(`@media (min-width: 1px) { .ws-skin-root { --skin-host-background: #102030; } }`);
|
||||
await frames();
|
||||
const beforeResize = control.style.getPropertyValue("--ws-control-background");
|
||||
viewportStyle.sheet.cssRules[0].media.mediaText = "(max-width: 1px)";
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
await frames();
|
||||
results.push({ ...snap("media-token-resize"), beforeResize });
|
||||
|
||||
theme.dispose();
|
||||
addSkinStyle(`.ws-skin-root { --skin-host-background: #ffffff; --skin-host-foreground: #111111; }`);
|
||||
await frames();
|
||||
|
||||
@@ -331,5 +331,9 @@ test("host control tokens follow late skin CSS, resolve modern colours and refus
|
||||
assert.equal(late.background, late.inlineBackground);
|
||||
assert.equal(late.inlineFont, "ui-sans-serif, system-ui, sans-serif", "a skin @font-face reached a host-owned control");
|
||||
assert.equal(byName["system-font"].inlineFont, 'Tahoma, "Segoe UI", sans-serif');
|
||||
assert.equal(byName["media-gated-skin-font"].inlineFont, "ui-sans-serif, system-ui, sans-serif", "a media-gated skin @font-face reached a host-owned control");
|
||||
const resized = byName["media-token-resize"];
|
||||
assert.equal(resized.beforeResize, "rgb(16, 32, 48)", "an @media token was not applied");
|
||||
assert.notEqual(resized.inlineBackground, resized.beforeResize, "a viewport change did not refresh @media tokens");
|
||||
assert.equal(byName["after-dispose"].inlineBackground, late.inlineBackground, "a disposed binding kept observing the document");
|
||||
});
|
||||
Reference in new issue
Block a user