优化
This commit is contained in:
@@ -9,6 +9,7 @@ import { listPlatformTenants, type PlatformTenantResource } from '@/modules/iam'
|
||||
import QueryToolbar from '@/shared/components/QueryToolbar.vue'
|
||||
import DataTable from '@/shared/components/DataTable.vue'
|
||||
import { listPlatformWarehouses } from '@/modules/warehouses'
|
||||
import { useAuthStore } from '@/core/auth/auth'
|
||||
import { downloadInboundCartonLabels, getPlatformInbound, listPlatformInbounds } from '../core/api'
|
||||
import type { InboundOrderDetail, InboundOrderSummary } from '../core/types'
|
||||
|
||||
@@ -73,6 +74,7 @@ describe('InboundOrdersView', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
setActivePinia(createPinia())
|
||||
useAuthStore().permissions = ['platform:firstleg:inbound:view']
|
||||
vi.mocked(listPlatformInbounds).mockResolvedValue({ records: [summary], page: 1, size: 20, total: 1, pages: 1 })
|
||||
vi.mocked(getPlatformInbound).mockResolvedValue(detail)
|
||||
vi.mocked(downloadInboundCartonLabels).mockResolvedValue(new Blob(['pdf'], { type: 'application/pdf' }))
|
||||
@@ -207,6 +209,16 @@ describe('InboundOrdersView', () => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('does not expose row operations without the confirmed inbound view permission', async () => {
|
||||
useAuthStore().permissions = []
|
||||
const wrapper = mountPage()
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.find('.row-actions').exists()).toBe(false)
|
||||
expect(wrapper.text()).toContain('无查看权限')
|
||||
expect(wrapper.text()).not.toContain('打印箱唛')
|
||||
})
|
||||
|
||||
it('uses the app header as the page title and exposes compact accessible status tabs', async () => {
|
||||
const wrapper = mountPage()
|
||||
await flushPromises()
|
||||
@@ -317,6 +329,9 @@ describe('InboundOrdersView', () => {
|
||||
expect(columnSource).toContain("{ key: 'feeReviewStatus', label: '费用审核状态'")
|
||||
expect(source).toContain('<template #processStatus="{ row }">')
|
||||
expect(source).toContain('<template #feeReviewStatus="{ row }">')
|
||||
expect(source).toContain("access.can('platform:firstleg:inbound:view')")
|
||||
expect(source).toContain('preference-key="inbound-orders-table"')
|
||||
expect(columnSource.match(/defaultVisible: false/g)?.length).toBeGreaterThanOrEqual(25)
|
||||
expect(toolbarSource).toMatch(/@media \(max-width: 720px\)[\s\S]*width: 100%/)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user