test(04-06): Wave 0 — inline-SVG source-contract RED + cursor-visibility regression pin

- tests/welcome/inline-svg.test.ts (NEW; 3 tests, node-env source-contract):
  - Test A: mokosh-mark.svg carries stroke="currentColor" + viewBox="0 0 32 32"
    (currently RED — SVG still has stroke="#181b2a").
  - Test B: welcome.ts uses ?raw import + DOMParser + replaceChildren and
    does NOT use innerHTML (MV3 CSP discipline / T-04-06-01).
    Currently RED — welcome.ts still ?url + <img>.
  - Test C: globals.d.ts declares the *.svg?raw ambient module.
    Currently RED — only *.svg?url + *.webm?url declared.
- tests/build/cursor-visibility.test.ts (NEW; 1 test, node-env file-grep):
  - GREEN-on-arrival regression pin for the cursor: 'always' literal at
    src/offscreen/recorder.ts:285 (shipped opportunistically Plan 01-09).
- Mirrors the canonical tests/i18n/manifest-i18n.test.ts scaffold
  (readFileSync + expect(text).toContain(...)) — vitest is environment:'node'
  and the project ships no DOM-emulation library, so the inline-svg test
  pins source TEXT only; the live-DOM injection + currentColor cascade is
  verified by the host-side harness assertion A35 (Task 3).
This commit is contained in:
2026-05-26 07:52:41 +02:00
parent 48c70535ff
commit f0b88d4d17
2 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
// tests/build/cursor-visibility.test.ts — Plan 04-06 cursor-visibility
// defensive regression pin (RESEARCH Finding 4 closure).
//
// Pins that src/offscreen/recorder.ts:285 carries the `cursor: 'always'`
// getDisplayMedia constraint — the original Phase-5 deferral was lifted
// opportunistically in Plan 01-09 (recorder.ts:285) and the back-patched
// Plan 04-06 closes the audit loop by both (a) re-verifying the literal
// via this defensive grep test and (b) flipping the stale "deferred to
// Phase 5" lines in .planning/phases/01-stabilize-video-pipeline/
// 01-07-SUMMARY.md (Task 3 of Plan 04-06).
//
// Polarity at land: GREEN-on-arrival — the literal already exists at
// recorder.ts:285 (verified at 04-06 re-plan iter-2; confirmed via
// `grep -n "cursor: 'always'" src/offscreen/recorder.ts`).
//
// SCOPE: node-env file-grep regression pin. Does NOT instantiate the
// MediaStream pipeline (out of scope for unit tests; the runtime visibility
// behavior is operator-empirical and out of the automated test loop —
// per UI-SPEC § the operator confirms the cursor appears in
// `video/last_30sec.webm` playback after a SAVE).
//
// References:
// - .planning/phases/04-harden-clean-up-optional/04-RESEARCH.md
// §Finding 4 (cursor visibility verification scope).
// - .planning/phases/01-stabilize-video-pipeline/01-07-SUMMARY.md
// (back-patched in Plan 04-06 Task 3 to remove the stale Phase-5
// deferral framing — the constraint shipped in Plan 01-09).
// - https://www.w3.org/TR/screen-capture/#dom-mediatrackconstraintset-cursor
// (W3C Screen Capture spec — `cursor` constraint values).
import { describe, expect, it } from 'vitest';
import { readFileSync } from 'node:fs';
import { resolve as resolvePath } from 'node:path';
const RECORDER_PATH = resolvePath(
process.cwd(),
'src/offscreen/recorder.ts',
);
describe("cursor visibility constraint shipped (Plan 01-09 -> verified Plan 04-06)", () => {
it("src/offscreen/recorder.ts contains the cursor: 'always' getDisplayMedia constraint literal", () => {
const text = readFileSync(RECORDER_PATH, 'utf8');
expect(text).toContain("cursor: 'always'");
});
});