This commit is contained in:
2026-09-18 16:48:35 +08:00
parent e3cca80ff2
commit 1d407620d2
59 changed files with 1879 additions and 1545 deletions
+24 -38
View File
@@ -28,57 +28,44 @@ function collectNavigationNodes(nodes) {
])
}
test('keeps the confirmed top-level sequence from the client workbench prototype', () => {
test('keeps account and notification routes as fixed-header utilities', () => {
assert.deepEqual(
clientNavigation.filter((node) => node.path).map(({ title, path, permission }) => ({
clientNavigation.filter((node) => node.hidden).map(({ title, path, permission }) => ({
title,
path,
permission,
})),
[
{ title: '业务总览', path: '/', permission: 'dashboard:view' },
{ title: '我的信息', path: '/account/profile', permission: 'account:profile:view' },
{ title: '我的消息', path: '/notifications', permission: 'merchant:notification:view' },
],
)
})
test('keeps only implemented navigation groups visible', () => {
test('organises every implemented business page under five task-oriented sidebar entries', () => {
assert.deepEqual(
clientNavigation.map((node) => ({
clientNavigation.filter((node) => !node.hidden).map((node) => ({
title: node.title,
children: node.children?.map(({ title }) => title),
})),
[
{ title: '业务总览', children: undefined },
{ title: '首页', children: undefined },
{
title: '头程物流',
children: ['订单列表', '快速下单'],
},
{
title: '出海下单',
children: ['海外采购', '美国本土卡', '美本土散板'],
title: '订单中心',
children: ['头程订单', '快速建草稿', '海外采购', '美国本土卡', '美本土散板', '入库订单', '派送订单'],
},
{
title: '海外仓',
children: ['贴标申请', '仓储转运', '货物废弃', '退货换标', '退货库存', '退货箱号管理'],
children: ['贴标申请', '仓储转运', '货物废弃', '退货预报与签收', '退货库存', '退货箱号管理'],
},
{
title: '订单管理',
children: ['入库订单列表', '派送订单列表'],
},
{
title: '财务结算',
title: '费用与账单',
children: ['资金账户', '客户账单'],
},
{
title: '企业管理',
title: '企业设置',
children: ['企业资料', '企业成员', '角色管理', '菜单权限'],
},
{ title: '我的信息', children: undefined },
{
title: '消息中心',
children: ['我的消息'],
},
],
)
})
@@ -103,14 +90,14 @@ test('flattens visible leaves with unique paths', () => {
'/cross-border/procurement',
'/cross-border/domestic-trucking',
'/cross-border/pallet-shipping',
'/orders/inbound',
'/orders/delivery',
'/overseas-warehouse/labeling',
'/overseas-warehouse/storage-transfer',
'/overseas-warehouse/cargo-disposal',
'/overseas-warehouse/return-relabel',
'/overseas-warehouse/return-inventory',
'/overseas-warehouse/return-cartons',
'/orders/inbound',
'/orders/delivery',
'/finance/account',
'/finance/bills',
'/company/profile',
@@ -127,8 +114,8 @@ test('flattens visible leaves with unique paths', () => {
test('filters inaccessible leaves and empty navigation groups', () => {
const visible = filterNavigationByPermissions(clientNavigation, ['account:profile:view', 'order:first-leg:list'])
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), ['/orders/first-leg', '/account/profile'])
assert.deepEqual(visible.map((item) => item.title), ['头程物流', '我的信息'])
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), ['/orders/first-leg'])
assert.deepEqual(visible.map((item) => item.title), ['订单中心'])
assert.equal(getFirstAccessiblePath(['account:profile:view']), '/account/profile')
assert.equal(getFirstAccessiblePath([]), '/forbidden')
})
@@ -142,8 +129,8 @@ test('excludes entries marked for manual hiding without affecting other visible
assert.deepEqual(getNavigationLeaves(visible).map((item) => item.path), ['/shown'])
})
test('puts enterprise management behind the prototype settings divider', () => {
const company = clientNavigation.find((node) => node.key === 'company')
test('puts enterprise settings behind the prototype settings divider', () => {
const company = clientNavigation.find((node) => node.key === 'company-center')
assert.ok(company)
assert.equal(company.dividerBefore, true)
@@ -202,8 +189,8 @@ test('returns navigation parent keys from outermost to innermost', () => {
]
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/'), [])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/orders/first-leg'), ['first-leg'])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/organization/members'), ['company'])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/orders/first-leg'), ['order-center'])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/organization/members'), ['company-center'])
assert.deepEqual(getNavigationParentKeys(syntheticTree, '/nested/leaf'), ['level-one', 'level-two'])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/not-found'), [])
})
@@ -212,18 +199,17 @@ test('builds complete breadcrumbs without repeating the current navigation page'
assert.deepEqual(getRouteBreadcrumbs('/', '业务总览'), [{ title: '首页' }])
assert.deepEqual(getRouteBreadcrumbs('/orders/first-leg', '订单列表'), [
{ title: '首页', path: '/' },
{ title: '头程物流' },
{ title: '订单中心' },
{ title: '订单列表' },
])
assert.deepEqual(getRouteBreadcrumbs('/orders/first-leg/create', '创建订单'), [
{ title: '首页', path: '/' },
{ title: '头程物流' },
{ title: '订单列表', path: '/orders/first-leg' },
{ title: '订单中心' },
{ title: '头程订单', path: '/orders/first-leg' },
{ title: '创建订单' },
])
assert.deepEqual(getRouteBreadcrumbs('/notifications/NOTICE-001', '消息详情'), [
{ title: '首页', path: '/' },
{ title: '消息中心' },
{ title: '我的消息', path: '/notifications' },
{ title: '消息详情' },
])
@@ -233,12 +219,12 @@ test('builds complete breadcrumbs without repeating the current navigation page'
])
})
test('opens the company parent group for a company route', () => {
test('opens the enterprise settings parent group for a company route', () => {
const openedKeys = []
openNavigationParentKeys('/organization/members', clientNavigation, (key) => openedKeys.push(key))
assert.deepEqual(openedKeys, ['company'])
assert.deepEqual(openedKeys, ['company-center'])
})
test('opens nested parent groups from outermost to innermost', () => {