This commit is contained in:
2026-10-20 11:54:44 +08:00
parent 5036593195
commit 8abc058a65
29 changed files with 445 additions and 78 deletions
+7 -19
View File
@@ -52,7 +52,7 @@ test('keeps standalone business pages at the client sidebar root', () => {
{ title: '首页', children: undefined },
{
title: '订单中心',
children: ['头程订单', '入库订单', '派送订单', '海外采购', '美国本土卡', '美本土散板'],
children: ['头程订单', '海外采购', '美国本土卡', '美本土散板'],
},
{ title: '报关资料', children: undefined },
{ title: '船期价格', children: undefined },
@@ -88,8 +88,6 @@ test('flattens visible leaves with unique paths', () => {
assert.deepEqual(paths, [
'/',
'/orders/first-leg',
'/orders/inbound',
'/orders/delivery',
'/cross-border/procurement',
'/cross-border/domestic-trucking',
'/cross-border/pallet-shipping',
@@ -121,22 +119,10 @@ test('filters inaccessible leaves and empty navigation groups', () => {
assert.equal(getFirstAccessiblePath([]), '/forbidden')
})
test('exposes active inbound and delivery queries only with their existing read permissions', () => {
const deliveryOnly = ['merchant:warehouse:delivery:list']
const inboundOnly = ['merchant:warehouse:inbound:list']
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation, deliveryOnly))
.map(({ title, path }) => ({ title, path })), [{ title: '派送订单', path: '/orders/delivery' }])
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation, inboundOnly))
.map(({ title, path }) => ({ title, path })), [{ title: '入库订单', path: '/orders/inbound' }])
assert.equal(getFirstAccessiblePath(deliveryOnly), '/orders/delivery')
assert.equal(getFirstAccessiblePath(inboundOnly), '/orders/inbound')
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation,
['merchant:warehouse:delivery:create'])), [])
assert.deepEqual(getRouteBreadcrumbs('/orders/delivery/DL-1', '派送单详情'), [
{ title: '首页', path: '/' }, { title: '订单中心' },
{ title: '派送订单', path: '/orders/delivery' }, { title: '派送单详情' },
])
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/orders/delivery'), ['order-center'])
test('omits inbound and delivery entries from the customer sidebar', () => {
const permissions = ['merchant:warehouse:delivery:list', 'merchant:warehouse:inbound:list']
assert.deepEqual(getNavigationLeaves(filterNavigationByPermissions(clientNavigation, permissions)), [])
assert.equal(getFirstAccessiblePath(permissions), '/forbidden')
})
test('excludes entries marked for manual hiding without affecting other visible items', () => {
@@ -383,6 +369,8 @@ test('exposes customer business lists and keeps utility routes outside navigatio
]
const hiddenActivePaths = new Set([
'orders/inbound',
'orders/delivery',
'first-leg/quick-order',
'overseas-warehouse/return-inventory',
'overseas-warehouse/return-cartons',
-2
View File
@@ -52,8 +52,6 @@ export const clientNavigation: ClientNavigationNode[] = [
icon: ClipboardList,
children: [
requireLeaf('first-leg-orders', '头程订单'),
requireLeaf('orders-inbound', '入库订单'),
requireLeaf('orders-delivery', '派送订单'),
requireLeaf('cross-border-procurement'),
requireLeaf('cross-border-domestic-trucking'),
requireLeaf('cross-border-pallet-shipping'),