优化
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const source = readFileSync(resolve(process.cwd(), 'src/modules/inbounds/measurement/InboundMeasurementDialog.vue'), 'utf8')
|
||||
const panelSource = readFileSync(resolve(process.cwd(), 'src/modules/inbounds/measurement/InboundMeasurementPanel.vue'), 'utf8')
|
||||
const taskListSource = readFileSync(resolve(process.cwd(), 'src/modules/inbounds/components/InboundTaskList.vue'), 'utf8')
|
||||
const orderListSource = readFileSync(resolve(process.cwd(), 'src/modules/unified-orders/pages/UnifiedOrdersView.vue'), 'utf8')
|
||||
|
||||
describe('InboundMeasurementDialog', () => {
|
||||
it('owns the complete measurement workspace behind one centered dialog', () => {
|
||||
expect(source).toContain('class="inbound-measurement-workspace-dialog"')
|
||||
expect(source).toContain('width="min(1240px, calc(100vw - 32px))"')
|
||||
expect(source).toContain('height: 92vh')
|
||||
expect(source).toContain('<WeightOcrPanel')
|
||||
expect(source).toContain('<InboundMeasurementPanel')
|
||||
expect(source).toContain('@summary-changed="handleWeightSummaryChanged"')
|
||||
expect(source).toContain('measurementPanelRef.value?.updateActualGrossWeight(actualGrossWeightKg)')
|
||||
})
|
||||
|
||||
it('is the only measurement dialog opened by both formal list entries', () => {
|
||||
for (const entrySource of [taskListSource, orderListSource]) {
|
||||
expect(entrySource).toContain('<InboundMeasurementDialog')
|
||||
expect(entrySource).not.toContain('<InboundMeasurementPanel')
|
||||
expect(entrySource).not.toContain('<WeightOcrPanel')
|
||||
}
|
||||
})
|
||||
|
||||
it('keeps draft saves open, closes only after submit, and refreshes parent entries consistently', () => {
|
||||
expect(source).toContain('@saved="handleUpdated"')
|
||||
expect(source).toContain('@updated="handleUpdated"')
|
||||
expect(source).toContain('@submitted="handleSubmitted"')
|
||||
expect(source).toContain("emit('updated')")
|
||||
expect(source).toContain("emit('update:modelValue', false)")
|
||||
expect(source).toContain("emit('submitted')")
|
||||
expect(panelSource).toContain("emit('saved')")
|
||||
expect(panelSource).toContain("emit('submitted')")
|
||||
})
|
||||
|
||||
it('uses the existing permission-aware panels and protects unsaved work on close', () => {
|
||||
expect(source).toContain('measurementPanelRef.value?.isDirty')
|
||||
expect(source).toContain('当前测量数据尚未保存')
|
||||
expect(source).toContain(':close-on-click-modal="false"')
|
||||
expect(source).toContain(':before-close="beforeClose"')
|
||||
expect(source).toContain('measurementPanelRef?.canEdit')
|
||||
expect(source).toContain('measurementPanelRef?.canSubmit')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user