Files
gods-eye-view/src/ui/kit/welcomeControls.test.mjs
T
Sameh KhamisandManjunath Paparaju 5301a0af8d Vue kit: the welcome card's buttons are UiButtons and its glyphs UiIcons
SKIP, the three start tiles, BROWSE STORIES, BACK and the main NEXT /
ENTER GOD MODE action are ghost UiButtons; the start tiles are pressed
toggles, and the others keep aria-disabled so they stay focusable while
the card is busy. The tile, tip, Stories and arrow glyphs are UiIcons
sized by first-run.css. God mode's preview globe and callouts stay inline
SVG drawings. A guard test pins it, the dismiss markup pin allows the kit
classes, and the first-run mutation anchors follow the new tile markup.

Co-authored-by: Manjunath Paparaju <[email protected]>
2026-11-19 02:45:21 -08:00

38 lines
1.7 KiB
JavaScript

// The welcome card's buttons and Material glyphs are the kit's: its template
// hand-writes no <button> and no Material Symbols span, and its one box is a
// UiCheckbox. Its two inline SVGs (God mode's globe and its callouts) are
// drawings, not glyphs, and its outbound links stay links.
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(
new URL('../views/WelcomeView.vue', import.meta.url),
'utf8',
);
/** The template block: everything outside script and style. */
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
test('the welcome card hand-writes no button; each is a UiButton', () => {
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
// SKIP, the three start tiles, BROWSE STORIES, BACK and the main action.
assert.equal(template.match(/<UiButton\b/g)?.length, 7);
assert.equal(template.match(/<UiCheckbox\b/g)?.length, 1);
});
test('the welcome card hand-writes no Material glyph; each is a UiIcon', () => {
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
// The three tiles, the three tips, the Stories card and the main arrow.
assert.equal(icons.length, 8);
// Without it the kit writes an 18px size that beats first-run.css's rules.
for (const icon of icons) assert.match(icon, /:size="null"/);
});
test('the only inline SVGs are God mode preview drawings', () => {
const svgs = [...template.matchAll(/<svg\b[^>]*>/g)].map((m) => m[0]);
assert.equal(svgs.length, 2);
assert.match(svgs[0], /class="first-run-globe"/);
assert.match(svgs[1], /class="first-run-callouts"/);
});