task-6(壳层/路由): 定义后端菜单树到侧边栏节点映射规则并落地

新增 src/layout/menu-mapper.ts:toSidebarEntries 处理分组/顶级路由叶/畸形节点,
groupKeysForActive 按当前路由展开激活分组;AdminLayout 菜单区改用映射结果,
删除旧 visibleChildren/canSee 死逻辑;8 用例覆盖空树/单叶/缺 route 过滤等。
This commit is contained in:
2026-09-05 12:17:17 +08:00
parent 4a0e464308
commit 26edb9e6ed
4 changed files with 158 additions and 31 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ test('test_task_003_layout_contract_boundary_empty_input', () => {
// 边界空值:菜单为空时应展示无菜单状态,且页面容器本身仍保留。
const layout = readSource(LAYOUT)
assert.ok(layout.includes('暂无可用菜单'), '无菜单需有空状态文案')
assert.ok(layout.includes('!groups.length'), '空菜单由 groups 长度驱动')
assert.ok(layout.includes('menuEntries.length'), '空菜单由映射结果长度驱动')
assert.equal(occurrences(layout, '<RouterView'), 1)
})