优化
This commit is contained in:
@@ -15,7 +15,31 @@ const cargoConsumers = [
|
||||
'container-loading/components/ContainerCustomsPanel.vue', 'container-loading/components/ContainerLastLegFeesPanel.vue',
|
||||
'loading-lists/components/ContainerFeesPanel.vue', 'port-schedules/components/CarrierScheduleQueryPanel.vue',
|
||||
]
|
||||
const overseasConsumers = [
|
||||
'overseas-warehouse/pages/LastMileOrdersView.vue',
|
||||
'overseas-warehouse/pages/LastMileOrderDetailView.vue',
|
||||
'overseas-warehouse/pages/InboundOrdersView.vue',
|
||||
'overseas-warehouse/pages/InboundOrderDetailView.vue',
|
||||
'overseas-warehouse/pages/DispatchesView.vue',
|
||||
'overseas-warehouse/pages/DispatchDetailView.vue',
|
||||
'overseas-warehouse/pages/OutboundsView.vue',
|
||||
'overseas-warehouse/pages/OutboundDetailView.vue',
|
||||
'overseas-warehouse/pages/DeliveryOrdersView.vue',
|
||||
'overseas-warehouse/pages/DeliveryOrderDetailView.vue',
|
||||
'overseas-warehouse/pages/RelabelOrdersView.vue',
|
||||
'overseas-warehouse/pages/RelabelOrderDetailView.vue',
|
||||
'overseas-warehouse/pages/PalletsView.vue',
|
||||
'overseas-warehouse/pages/PalletDetailView.vue',
|
||||
'overseas-warehouse/pages/InventoryView.vue',
|
||||
'overseas-warehouse/pages/InventoryDetailView.vue',
|
||||
'overseas-warehouse/pages/InventoryTransactionsView.vue',
|
||||
'overseas-warehouse/pages/ReturnInventoryManagementView.vue',
|
||||
'overseas-warehouse/components/WarehouseTransferReviewDialog.vue',
|
||||
'overseas-warehouse/components/SmartDispatchDialog.vue',
|
||||
'overseas-warehouse/components/DeliveryDocumentsDialog.vue',
|
||||
]
|
||||
const consumers = [
|
||||
...overseasConsumers,
|
||||
...cargoConsumers,
|
||||
'customers/pages/CustomersView.vue', 'customers/pages/CustomerDetailView.vue',
|
||||
'customers/pages/OverseasStorageFeesView.vue', 'customers/components/CustomerBillingRulesPanel.vue',
|
||||
@@ -45,6 +69,7 @@ const customerPages = [
|
||||
{ title: '海外仓阶梯费用', path: '/customers/overseas-storage-fees', file: 'customers/pages/OverseasStorageFeesView.vue' },
|
||||
]
|
||||
const densityPages = [...new Set([
|
||||
...overseasConsumers.filter(file => !file.endsWith('PalletDetailView.vue')),
|
||||
...cargoConsumers.filter(file => file.includes('/pages/') || ['ContainerOverviewPanel.vue', 'ContainerCustomsPanel.vue', 'ContainerLastLegFeesPanel.vue', 'ContainerFeesPanel.vue', 'OceanBookingDocumentsPanel.vue'].some(name => file.endsWith(name))),
|
||||
...domesticPages.map(page => page.file), 'loading-lists/pages/PreloadPlanDetailView.vue',
|
||||
'loading-lists/components/LoadingListDetailDrawer.vue', 'domestic-containers/pages/DomesticContainerInventoryDetailView.vue',
|
||||
@@ -73,6 +98,62 @@ const cssRoot = (css: string) => {
|
||||
}
|
||||
|
||||
describe('approved Admin density ownership', () => {
|
||||
|
||||
it('covers all ten overseas warehouse menus, details and both return inventory modes', () => {
|
||||
const navigation = read('core/navigation/adminNavigation.ts')
|
||||
const section = navigation.slice(navigation.indexOf("key: 'overseas-inventory'"), navigation.indexOf("key: 'customer-service'"))
|
||||
for (const path of ['last-mile-orders', 'inbound-orders', 'dispatches', 'outbounds', 'delivery-orders', 'relabel-orders', 'pallets', 'inventory', 'return-inventory', 'return-cartons']) expect(section).toContain("path: '/overseas-warehouse/" + path + "'")
|
||||
expect([...section.matchAll(/path: '/g)]).toHaveLength(10)
|
||||
const routes = read('modules/overseas-warehouse/routes.ts')
|
||||
for (const mode of ['inventory', 'cartons']) expect(routes).toContain("mode: '" + mode + "'")
|
||||
for (const file of overseasConsumers) {
|
||||
const source = read('modules/' + file)
|
||||
expect(source, file).toContain('@/styles/adminDensity.css')
|
||||
expect(parse(source).errors, file).toEqual([])
|
||||
if (file.endsWith('DetailView.vue') && !/OutboundDetail|DeliveryOrderDetail/.test(file)) {
|
||||
const root = parse(source).descriptor.template!.ast!.children.find(node => node.type === 1) as ElementNode
|
||||
expect(root.tag).toMatch(/^Overseas(?:DetailShell|ReadOnlyDetail)$/)
|
||||
expect(root.props.some(prop => prop.type === 6 && prop.name === 'dense')).toBe(true)
|
||||
expect(classesOf(root)).toContain('admin-density')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps contained overseas tab content and external cargo tab bodies separate', () => {
|
||||
expect(shared).toContain('.density-element-tabs:not(.density-contained-tabs) > .el-tabs__content { display: none; }')
|
||||
for (const file of ['LastMileOrderDetailView', 'DeliveryOrderDetailView']) {
|
||||
const source = read('modules/overseas-warehouse/pages/' + file + '.vue')
|
||||
const ast = parse(source).descriptor.template!.ast!
|
||||
let panes = 0
|
||||
const visit = (nodes: typeof ast.children) => { for (const node of nodes) {
|
||||
if (node.type !== 1) continue
|
||||
if (node.tag === 'el-tabs') expect(classesOf(node)).toContain('density-contained-tabs')
|
||||
if (node.tag === 'el-tab-pane') {
|
||||
panes++
|
||||
expect(node.children.some(child => child.type === 1 && child.tag !== 'template'), file + ': pane retains body').toBe(true)
|
||||
expect(node.loc.source).toContain('density-tab-icon')
|
||||
}
|
||||
visit(node.children)
|
||||
} }
|
||||
visit(ast.children)
|
||||
expect(panes).toBe(file === 'LastMileOrderDetailView' ? 5 : 4)
|
||||
}
|
||||
})
|
||||
|
||||
it('opts shared overseas detail and relationship wrappers in only at approved callers', () => {
|
||||
for (const file of ['modules/overseas-warehouse/components/OverseasDetailShell.vue', 'modules/overseas-warehouse/components/OverseasReadOnlyDetail.vue', 'shared/components/InboundCodeRelationshipDialog.vue']) {
|
||||
const source = read(file)
|
||||
expect(source).toContain('dense?: boolean')
|
||||
const ast = parse(source).descriptor.template!.ast!
|
||||
const root = ast.children.find(node => node.type === 1) as ElementNode
|
||||
expect(classesOf(root, false, true).some(name => name.startsWith('admin-density')), file).toBe(true)
|
||||
expect(classesOf(root, false, false).some(name => name.startsWith('admin-density')), file).toBe(false)
|
||||
}
|
||||
expect(read('modules/overseas-warehouse/components/OverseasReadOnlyDetail.vue')).toContain(':dense="dense"')
|
||||
expect(read('modules/overseas-warehouse/pages/InventoryTransactionsView.vue')).toContain('<InboundCodeRelationshipDialog dense')
|
||||
for (const file of ['CartonDetailView', 'ProductDetailView']) expect(read('modules/overseas-warehouse/pages/' + file + '.vue')).not.toContain(' dense')
|
||||
})
|
||||
|
||||
it('covers four cargo menus, independent detail routes and both workbench modes', () => {
|
||||
const navigation = read('core/navigation/adminNavigation.ts')
|
||||
for (const path of ['/ocean-bookings', '/trucking', '/container-loading/domestic', '/container-loading/overseas']) expect(navigation).toContain(`path: '${path}'`)
|
||||
|
||||
Reference in New Issue
Block a user