Skip to content

Commit 488cb53

Browse files
committed
test(motion): 加固响应层回执的过渡见证判据
1 parent fef4a8d commit 488cb53

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎app/src/motion/responseCoverage.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ describe("① 七类动作逐类覆盖:今天的调用面形态 + 回执落点
157157
for (const sel of cls.elements) {
158158
expect(hasLanding(sel), `${cls.name} 的落点 ${sel} 不在响应层节里(基选择器口径)`).toBe(true);
159159
}
160+
// **过渡见证**:本类至少一条落点**声明了 transition** —— 只剩一条状态规则(如 `:checked`)时,
161+
// "回执"没有时长/缓动可言(m01 变异实测:删掉 base 规则后仅靠状态规则仍会假绿)。
162+
const withTransition = cls.elements.some((shape) =>
163+
TRANSITION_SELECTORS.some((t) => baseSelector(t).includes(shape)),
164+
);
165+
expect(withTransition, `${cls.name} 的落点里没有一条声明 transition ⇒ 回执没有时长/缓动`).toBe(true);
160166
return;
161167
}
162168
expect(cls.primitive, `${cls.name} 既没有元素级落点、也没有原语承载`).not.toBeNull();
@@ -190,7 +196,9 @@ describe("② 安全网:响应层的声明集合审计(动效不得改变交
190196

191197
describe("③ 未覆盖余量逐条登记(防「把余量写成 0」;登记表必须锚到真实调用点)", () => {
192198
it(`余量恰 ${UNCOVERED.length} 条,且每条锚点在盘上仍然存在`, () => {
193-
expect(UNCOVERED.map((r) => r.key)).toHaveLength(UNCOVERED.length);
199+
const keys = UNCOVERED.map((r) => r.key);
200+
expect(new Set(keys).size, "余量登记表的键必须唯一(复制粘贴时最容易犯)").toBe(keys.length);
201+
expect(keys.every((k) => k.trim().length > 4), "余量登记表的键不得为空").toBe(true);
194202
expect(UNCOVERED.length, "余量条数变了 ⇒ 先核实再改这个数(不许写 0)").toBe(7);
195203
for (const r of UNCOVERED) {
196204
const abs = join(SRC, ...r.file.split("/"));

0 commit comments

Comments
 (0)