import test from 'node:test' import assert from 'node:assert/strict' import { existsSync, readdirSync, statSync } from 'node:fs' import { join } from 'node:path' import { readSource } from './helpers.ts' /** * 操作列的按钮一旦超过列宽,会**整颗消失**而不是换行:这些页的 td 是 `overflow:hidden` + * `table-layout:fixed`,而 `.ops-cell` 是 nowrap flex。2026-10-08 店铺密钥那单"没有删除功能" * 就是这么来的——按钮在线上包的 DOM 里、事件也在,只是被裁到看不见点不到(列给 160px、实测需 240px)。 * * 这条看守钉的是**结构**不是像素:宽度按当前文案够,改天多一颗按钮或文案变长就又塌了, * 而 `flex-wrap: wrap` 让"超宽"从"静默消失"退化成"多占一行",不需要有人去重算宽度。 */ const SRC = 'src/pages' function vueFiles(dir: string): string[] { const out: string[] = [] for (const name of readdirSync(dir)) { const p = join(dir, name) if (statSync(p).isDirectory()) out.push(...vueFiles(p)) else if (name.endsWith('.vue')) out.push(p) } return out } interface Cell { file: string buttons: number wrapped: boolean } /** 只做解析,不碰磁盘:读源码这一步留在用例体内(见 source-pin-ratchet 对"隔层 helper"的口径)。 */ function opsCells(sources: Array<{ file: string; source: string }>): Cell[] { const cells: Cell[] = [] for (const { file, source } of sources) { const block = /\.ops-cell[ \t]*\{([^}]*)\}/.exec(source) if (!block) continue const td = /]*class="[^"]*ops[^"]*"[^>]*>([\s\S]*?)<\/td>/.exec(source) const buttons = td ? (td[1].match(/