From 50defbae582489e9163bb5eb57460f7d9f83aa2f Mon Sep 17 00:00:00 2001 From: Federico Jaramillo Martinez Date: Fri, 17 Jul 2026 22:17:09 +0200 Subject: [PATCH] refactor(test): remove unused template-inspection helpers Remove the three shared template-inspection test helpers that had no consumer after the Slice B migrations: templateStaticMarkup, collectTemplateStrings, and collectStringValues. They were kept alive only by a temporary @public knip shim; with no in-window test needing them, the finish-line requirement forbids dead helpers, so remove them outright. knip is now satisfied without the shim. --- .../src/templateInspection.testSupport.ts | 71 ------------------- 1 file changed, 71 deletions(-) diff --git a/src/client/src/templateInspection.testSupport.ts b/src/client/src/templateInspection.testSupport.ts index b28a38b..0f7b326 100644 --- a/src/client/src/templateInspection.testSupport.ts +++ b/src/client/src/templateInspection.testSupport.ts @@ -64,53 +64,6 @@ export function isTemplateEventHandler(value: unknown): return typeof value === "function"; } -/** - * Concatenate only the static markup chunks of a template tree. - * - * Use for asserting stable structural markers (tag/attribute names, ids - * intentionally used by the component) while locating wiring — not as a general - * content-assertion tool. - * - * @public - */ -export function templateStaticMarkup(template: TemplateResult): string { - const chunks: string[] = []; - visit(template); - return chunks.join(""); - - function visit(value: unknown): void { - if (Array.isArray(value)) { - for (const item of value) visit(item); - return; - } - if (!isTemplateResult(value)) return; - chunks.push(...templateStrings(value)); - for (const child of templateValues(value)) visit(child); - } -} - -/** - * The static markup chunks of a template tree as a flat array. - * - * @public - */ -export function collectTemplateStrings(template: TemplateResult): string[] { - const strings: string[] = []; - visit(template); - return strings; - - function visit(current: TemplateResult): void { - strings.push(...templateStrings(current)); - for (const value of templateValues(current)) { - if (Array.isArray(value)) { - for (const item of value) if (isTemplateResult(item)) visit(item); - } else if (isTemplateResult(value)) { - visit(value); - } - } - } -} - /** * Flatten static markup interleaved with primitive (string/number) values into * a single string, in document order. @@ -125,30 +78,6 @@ export function templateText(value: unknown): string { return typeof value === "string" || typeof value === "number" ? String(value) : ""; } -/** - * Collect every interpolated string value in a template tree, in order. - * - * @public - */ -export function collectStringValues(template: TemplateResult): string[] { - const found: string[] = []; - visit(template); - return found; - - function visit(value: unknown): void { - if (typeof value === "string") { - found.push(value); - return; - } - if (Array.isArray(value)) { - for (const item of value) visit(item); - return; - } - if (!isTemplateResult(value)) return; - for (const child of templateValues(value)) visit(child); - } -} - /** * Every interpolated value whose immediately preceding static chunk includes * `marker`, collected across the whole tree in document order.