import { readFileSync } from 'node:fs'; import assert from 'node:assert/strict'; const css = readFileSync(new URL('../src/style.css', import.meta.url), 'utf8'); const themeCss = readFileSync(new URL('../src/ios-widget.css', import.meta.url), 'utf8'); const neonCss = readFileSync(new URL('../src/workbench-neon.css', import.meta.url), 'utf8'); const rule = css.match(/\.hmi-diagnostic-notice \.hmi-mes-login input\s*\{([^}]+)\}/)?.[1]; assert.ok(rule, 'Scoped IMSAPI input CSS is present'); for (const expected of ['background:var(--input)', 'color:var(--text)', 'caret-color:var(--text)', 'border:1px solid var(--line)']) { assert.ok(rule.includes(expected), `Missing contrast rule: ${expected}`); } assert.ok(!rule.includes('color:inherit'), 'Login text must not inherit label color'); assert.match(css, /\.hmi-diagnostic-notice \.hmi-mes-login input::placeholder\{color:var\(--muted\)/); assert.match(css, /\.hmi-diagnostic-notice \.hmi-mes-login input:focus-visible/); assert.match(css, /-webkit-text-fill-color:var\(--text\)/); assert.match(css, /-webkit-box-shadow:0 0 0 1000px var\(--input\) inset/); assert.match(css, /\.shell\.ios \.hmi-mes-login input,\.shell\.light \.hmi-mes-login input\{color-scheme:light\}/); assert.match(css, /\.shell\.dark \.hmi-mes-login input,\.shell\.neon \.hmi-mes-login input\{color-scheme:dark\}/); assert.match(themeCss, /\.shell\.ios\s*\{[^}]*--input:#fff/); assert.match(neonCss, /--input:#0e1b25/); console.log('OK: IMSAPI login contrast, focus, placeholder, and autofill styles');