Skip to content

Commit 882a61e

Browse files
committed
test(shell): pin column tier mapping
Adds one case: every collapsible row's autoFoldBelow must match its spec 6.2 tier kind (row-to-tier mapping), which the existing value-in-BREAKPOINTS check cannot catch. Existing assertions untouched.
1 parent 4f8f3d3 commit 882a61e

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎app/src/shell/columnRegistry.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,32 @@ describe("列注册表(规格 §6.2)", () => {
117117
expect(columnsOf("action")).toHaveLength(1);
118118
});
119119

120+
it("④ 八处可折叠行的 autoFoldBelow 与规格 §6.2 逐行一致(行↔档位的映射不许错配)", () => {
121+
// Why 单列这一条:只判「值 ∈ BREAKPOINTS」判不出「这一行用错了档位」
122+
// (把 notes-list 从 threeCol 写成 twoCol,值仍是合法断点 ⇒ 静默错配)。
123+
// 期望值写 `BREAKPOINTS.<kind>`——档位数字本身由 breakpoints.test.ts 的三条逐字锚点冻结,
124+
// 本条的职责是**行与档位的对应关系**,不是再冻结一次数字。
125+
const want: Record<string, number> = {
126+
"classroom-left": BREAKPOINTS.twoCol,
127+
"sessions-list": BREAKPOINTS.twoCol,
128+
"notes-groups": BREAKPOINTS.threeCol,
129+
"notes-list": BREAKPOINTS.threeCol,
130+
"notes-outline": BREAKPOINTS.outlineCol,
131+
"chat-sidebar": BREAKPOINTS.twoCol,
132+
"knowledge-left": BREAKPOINTS.twoCol,
133+
"goals-left": BREAKPOINTS.twoCol,
134+
};
135+
const got = Object.fromEntries(
136+
COLUMN_SPECS.map((c: ColumnSpec) => c)
137+
.filter((c) => c.autoFoldBelow != null)
138+
.map((c) => [c.key, c.autoFoldBelow]),
139+
);
140+
expect(got, "可折叠行的档位映射与规格 §6.2 不一致").toEqual(want);
141+
// 阴性样本:§6.2 写「不折叠」的详情列与四条单列行不得混进来
142+
expect(got["knowledge-detail"]).toBeUndefined();
143+
expect(got["settings-main"]).toBeUndefined();
144+
});
145+
120146
it("① 与规格 §6.2 的九个数字逐字一致(抽样锚点,防整表被改错)", () => {
121147
expect(columnSpec("classroom-left").default).toBe(320);
122148
expect(columnSpec("notes-groups").default).toBe(240);

0 commit comments

Comments
 (0)