Files
SlabUploader/frontend/src/create/review/reviewUi.contract.test.ts
T
grokbot_ty 20a7d7d9d5 feat(ui): Jeff-facing copy + 3:4 inventory thumbs + fixed overlay font
Locked UI/copy pass on proto-per-user-woo-creds (Settings/Woo gate polish out of scope):
- Inventory PNG thumbs at 3:4 contain (Review, Publish preview, Photos ready); stop 1:1 cover squaring
- Dimension overlay labels fixed OVERLAY_FONT_PX=36 for every product
- Page 1–3 Jeff-plain copy; drop Measure red tech essays / px scale rows
- Review: lock SVG, consistent red missing/not-ready, View prompt gated (Settings default off)
2026-09-27 09:04:47 -07:00

77 lines
3.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { test } from 'node:test';
const dir = dirname(fileURLToPath(import.meta.url));
const reviewSrc = readFileSync(join(dir, 'Review.svelte'), 'utf8');
const figSrc = readFileSync(join(dir, 'figTags.ts'), 'utf8');
test('Review UI: no AI assist labels or AI badge chrome', () => {
assert.equal(reviewSrc.includes('AI assist'), false);
assert.equal(reviewSrc.includes('class="ai"'), false);
assert.equal(reviewSrc.includes('ps-tag'), false);
});
test('Review UI: no fig-* MultiSelect picker', () => {
assert.equal(reviewSrc.includes('data-testid="fig-tag"'), false);
assert.equal(reviewSrc.includes('figTagOpts'), false);
assert.equal(reviewSrc.includes('label="fig-* tags"'), false);
assert.equal(reviewSrc.includes('placeholder="Choose fig-* tags"'), false);
assert.match(reviewSrc, /deriveFigTagIds/);
assert.match(reviewSrc, /Features/);
assert.match(reviewSrc, /testid="feat-tag"/);
});
test('Tag family scope uses hyphenated slug prefix', () => {
assert.match(figSrc, /startsWith\('fig-'\)/);
assert.match(figSrc, /startsWith\('feat-'\)/);
assert.equal(/startsWith\('fig'\)/.test(figSrc), false);
assert.equal(/startsWith\('feat'\)/.test(figSrc), false);
assert.equal(/startsWith\('fig'\)/.test(reviewSrc), false);
assert.equal(/startsWith\('feat'\)/.test(reviewSrc), false);
});
test('Review UI: View prompt + Create desc gate wiring', () => {
assert.match(reviewSrc, /data-testid="view-prompt"/);
assert.match(reviewSrc, /getCall2Prompt/);
assert.match(reviewSrc, /createDescMissing/);
assert.match(reviewSrc, /missingCreateDescLabels/);
assert.match(reviewSrc, /create-title-missing/);
assert.match(reviewSrc, /title_built/);
assert.match(reviewSrc, /orderWoodCatGroups/);
assert.match(reviewSrc, /applyMoistureDefault/);
assert.match(reviewSrc, /onCommit=\{commitReview\}/);
// Description is not part of the Create-desc gate label list
assert.equal(reviewSrc.includes("Create desc needs: description"), false);
});
test('Review UI: live field commit + unified secondary buttons + moisture default', () => {
assert.match(reviewSrc, /scheduleFieldCommit/);
assert.match(reviewSrc, /scheduleDescCommit/);
assert.match(reviewSrc, /class="btn-sec"/);
assert.match(reviewSrc, /applyMoistureDefault/);
assert.match(reviewSrc, /void syncSelects\(\)/);
// No leftover white unstyled view-prompt class
assert.equal(reviewSrc.includes('view-prompt-btn'), false);
assert.equal(reviewSrc.includes('create-btn'), false);
});
test('Review UI: Jeff-facing copy + 3:4 thumbs + View prompt gated', () => {
assert.match(reviewSrc, /Review slab/);
assert.match(reviewSrc, /Square feet \/ Board feet/);
assert.match(reviewSrc, /Create short description/);
assert.match(reviewSrc, /Create description/);
assert.match(reviewSrc, /Generate short and full description/);
assert.match(reviewSrc, /3–24 letters, numbers, or hyphens/);
assert.match(reviewSrc, /aspect-ratio: 3 \/ 4/);
assert.match(reviewSrc, /object-fit: contain/);
assert.match(reviewSrc, /getShowViewPrompt/);
assert.match(reviewSrc, /showViewPrompt/);
assert.equal(reviewSrc.includes('Call 2'), false);
assert.equal(reviewSrc.includes('Review to Ready'), false);
assert.equal(/aspect-ratio:\s*1\b/.test(reviewSrc), false);
});