Keep zoom CSS compatibility test scoped

The local main branch already contains memory theme tokens that use color-mix, so the Safari compatibility assertion should cover the startup-sensitive zoom slider CSS block instead of the entire stylesheet.

Constraint: Existing main theme tokens intentionally include color-mix for non-zoom surfaces.
Rejected: Remove the Safari compatibility assertion | the zoom slider still needs coverage for WebView-safe CSS.
Confidence: high
Scope-risk: narrow
Tested: bunx vitest run src/__tests__/generalSettings.test.tsx src/theme/globals.test.ts
Not-tested: Full bun run verify
This commit is contained in:
程序员阿江(Relakkes) 2026-05-14 23:27:18 +08:00
parent 57e66f0019
commit 20035d0fd8

View File

@ -22,6 +22,14 @@ function getThemeBlock(selector: ':root,\n[data-theme="light"]' | '[data-theme="
throw new Error(`Theme block not closed: ${selector}`)
}
function getCssBetween(startMarker: string, endMarker: string) {
const start = css.indexOf(startMarker)
expect(start).toBeGreaterThanOrEqual(0)
const end = css.indexOf(endMarker, start)
expect(end).toBeGreaterThan(start)
return css.slice(start, end)
}
describe('desktop theme tokens', () => {
const themes = [':root,\n[data-theme="light"]', '[data-theme="white"]', '[data-theme="dark"]'] as const
const requiredTokens = [
@ -63,8 +71,10 @@ describe('desktop theme tokens', () => {
}
})
it('avoids color-mix in startup-critical shell chrome for Safari 15 WebView support', () => {
expect(css).not.toContain('color-mix(')
it('avoids color-mix in the startup-critical UI zoom shell chrome for Safari 15 WebView support', () => {
const zoomShellCss = getCssBetween('.settings-zoom-kbd {', '/* ─── Tailwind Theme Override')
expect(zoomShellCss).not.toContain('color-mix(')
})
it('keeps the UI zoom slider thumb visible in dark mode', () => {