test(w05): 「全只读」连编辑闸的外壳一起说死 —— data-edit= 这个子串照不到它们

2026-08-29 评审自拟变异逮到的盲点:editGate()/addrow() 产出的是 data-edit-open= /
-cancel= / -save= / -for= / -add= / -del=,edit 后面跟的是连字符,永远凑不出
data-edit= 这个连续子串。实测往 landing-confirm 插一个孤立的
<button data-edit-open=…>,原有三条断言原样全绿。

眼下没触发(这份件零处调用那两个 helper),但光有闸没有 data-col 孪生格虽然写不进
数据,屏上会冒出一枚按不出结果的「编辑」钮 —— 那是界面撒谎。

变异验证:注入后两条断言都真红;复原后 report.ts 与 HEAD 逐字节一致,
包内 59 passed、pnpm gates 退出码 0。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LKMZDwMbyKzjw6Hembwvet
This commit is contained in:
xcs
2026-08-29 21:08:20 +08:00
co-authored by Claude Opus 5
parent 4bd1a04511
commit 77df79d6fb
@@ -364,6 +364,9 @@ describe('报告模版:编辑面与只读面各就各位', () => {
it('落账确认只读:没有任何 data-edit / data-col(差异审核已按 spec §4.4 变为可就地编辑,断言见「件②」组)', () => {
expect(viewHtml('landing-confirm')).not.toContain('data-edit=');
expect(viewHtml('landing-confirm')).not.toContain('data-col=');
/* 编辑闸的外壳也不许有 —— 理由见下面「全只读」那条的注释(`data-edit=` 这个子串照不到它们) */
expect(viewHtml('landing-confirm')).not.toContain('data-edit-open=');
expect(viewHtml('landing-confirm')).not.toContain('data-edit-add=');
});
it('每个可编辑格子的 data-col 都在对应台账对象的声明里(input-supplement 一屏三张表,三张台账对象的声明并起来看;difference-review 一张表)', () => {
@@ -567,10 +570,22 @@ describe('件③ 落账确认', () => {
.find((s) => s.item === 'T_release')?.view).toBe('landing-confirm');
});
it('**全只读** —— 签之前只核对,不改', () => {
/*
* **`data-edit=` 这个子串照不到编辑闸的外壳**(2026-08-29 评审自拟变异逮到的盲点):
* `editGate()` / `addrow()` 产出的是 `data-edit-open=` / `-cancel=` / `-save=` / `-for=` /
* `-add=` / `-del=` —— `edit` 后面跟的是连字符,**永远凑不出 `data-edit=`**。
* 实测:往这份件里插一个孤立的 `<button data-edit-open="…">`,上面三条断言原样全绿。
* 眼下没触发(这份件零处调用那两个 helper),但「全只读」得连外壳一起说死 ——
* 光有闸没有 `data-col` 孪生格虽然写不进数据,可屏上会冒出一枚按不出结果的「编辑」钮,
* 那是**界面撒谎**。
*/
it('**全只读** —— 签之前只核对,不改(连编辑闸的外壳一起,别只挡 data-edit=)', () => {
expect(html).not.toContain('data-edit=');
expect(html).not.toContain('data-col=');
expect(html).not.toContain('<script');
for (const shell of ['data-edit-open=', 'data-edit-cancel=', 'data-edit-save=', 'data-edit-for=', 'data-edit-add=', 'data-edit-del=']) {
expect(html, shell).not.toContain(shell);
}
});
it('把「进哪几张表各几行」摆出来,用的是基座读数', () => {