优化
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
getFirstAccessiblePath,
|
||||
getNavigationLeaves,
|
||||
getNavigationParentKeys,
|
||||
getRouteBreadcrumbs,
|
||||
openNavigationParentKeys,
|
||||
} from './clientNavigation.ts'
|
||||
|
||||
@@ -207,6 +208,31 @@ test('returns navigation parent keys from outermost to innermost', () => {
|
||||
assert.deepEqual(getNavigationParentKeys(clientNavigation, '/not-found'), [])
|
||||
})
|
||||
|
||||
test('builds complete breadcrumbs without repeating the current navigation page', () => {
|
||||
assert.deepEqual(getRouteBreadcrumbs('/', '业务总览'), [{ title: '首页' }])
|
||||
assert.deepEqual(getRouteBreadcrumbs('/orders/first-leg', '订单列表'), [
|
||||
{ title: '首页', path: '/' },
|
||||
{ title: '头程物流' },
|
||||
{ title: '订单列表' },
|
||||
])
|
||||
assert.deepEqual(getRouteBreadcrumbs('/orders/first-leg/create', '创建订单'), [
|
||||
{ title: '首页', path: '/' },
|
||||
{ title: '头程物流' },
|
||||
{ title: '订单列表', path: '/orders/first-leg' },
|
||||
{ title: '创建订单' },
|
||||
])
|
||||
assert.deepEqual(getRouteBreadcrumbs('/notifications/NOTICE-001', '消息详情'), [
|
||||
{ title: '首页', path: '/' },
|
||||
{ title: '消息中心' },
|
||||
{ title: '我的消息', path: '/notifications' },
|
||||
{ title: '消息详情' },
|
||||
])
|
||||
assert.deepEqual(getRouteBreadcrumbs('/forbidden', '无权访问'), [
|
||||
{ title: '首页', path: '/' },
|
||||
{ title: '无权访问' },
|
||||
])
|
||||
})
|
||||
|
||||
test('opens the company parent group for a company route', () => {
|
||||
const openedKeys = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user