优化
This commit is contained in:
@@ -5,6 +5,13 @@ import { describe, expect, it } from 'vitest'
|
||||
const source = readFileSync(resolve(process.cwd(), 'src/modules/ocean-bookings/pages/OceanBookingDetailView.vue'), 'utf8')
|
||||
|
||||
describe('OceanBookingDetailView interaction contract', () => {
|
||||
it('recognizes the dedicated create route as an editable new booking', () => {
|
||||
expect(source).toContain("route.name === 'ocean-booking-create' || id.value === 'new'")
|
||||
expect(source).toContain('const editable = computed(() => isNew.value)')
|
||||
expect(source).not.toContain("status === 'DRAFT'")
|
||||
expect(source).toContain("? access.can('platform:firstleg:ocean-booking:create')")
|
||||
})
|
||||
|
||||
it('selects business objects and automatically keeps their ids and names together', () => {
|
||||
expect(source).toContain('placeholder="请选择客户(可选)"')
|
||||
expect(source).toContain('filterable clearable')
|
||||
@@ -51,17 +58,23 @@ describe('OceanBookingDetailView interaction contract', () => {
|
||||
]) expect(source).toContain(`placeholder="${placeholder}"`)
|
||||
})
|
||||
|
||||
it('keeps release-only transport facts out of draft editing and saving', () => {
|
||||
it('captures known offline booking facts during creation and only reviews them during release', () => {
|
||||
for (const field of ['billOfLadingNo', 'vesselName', 'voyageNo', 'estimatedSailingAt', 'estimatedArrivalAt']) {
|
||||
expect(source).not.toContain(`v-model="form.data.${field}"`)
|
||||
expect(source).toContain(`v-model="form.data.${field}"`)
|
||||
expect(source).toContain(`prop="${field}"`)
|
||||
}
|
||||
expect(source).toContain(':model-value="detail?.billOfLadingNo || \'\'" disabled placeholder="确认放舱时录入"')
|
||||
expect(source).toContain(':model-value="detail?.vesselName || \'\'" disabled placeholder="确认放舱时录入"')
|
||||
expect(source).toContain('v-model="releaseForm.billOfLadingNo"')
|
||||
expect(source).toContain('v-model="releaseForm.vesselName"')
|
||||
expect(source).toContain('v-model="releaseForm.voyageNo"')
|
||||
expect(source).toContain('v-model="releaseForm.estimatedSailingAt"')
|
||||
expect(source).toContain('v-model="releaseForm.estimatedArrivalAt"')
|
||||
expect(source).not.toContain('确认放舱时录入')
|
||||
expect(source).toContain('billOfLadingNo: value.billOfLadingNo || \'\'')
|
||||
expect(source).toContain('estimatedSailingAt: value.estimatedSailingAt || null')
|
||||
expect(source).toContain('if (form.data.estimatedArrivalAt! < form.data.estimatedSailingAt!)')
|
||||
expect(source).toContain('请复核已登记的真实订舱资料。放舱不会重新采集或修改这些信息。')
|
||||
expect(source).toContain('const billOfLadingNo = detail.value.billOfLadingNo?.trim()')
|
||||
expect(source).toContain('const estimatedSailingAt = detail.value.estimatedSailingAt')
|
||||
expect(source).toContain('v-model="releaseReason"')
|
||||
expect(source).not.toContain('v-model="releaseForm.')
|
||||
expect(source).toContain('线下订舱资料已登记并确认')
|
||||
expect(source).toContain("{{ isNew ? '登记订舱' : '保存' }}")
|
||||
expect(source).toContain('登记后直接确认')
|
||||
})
|
||||
|
||||
it('uses source-backed free text terms and keeps capacity snapshots behind one specification control', () => {
|
||||
@@ -147,9 +160,17 @@ describe('OceanBookingDetailView interaction contract', () => {
|
||||
|
||||
it('shows client-side validation failures instead of rendering an empty error alert', () => {
|
||||
expect(source).toContain(':title="actionError.message"')
|
||||
expect(source).toContain("actionError.value = { message: '请完善装柜仓库、物流渠道和运输条款等必填信息' }")
|
||||
expect(source).toContain("actionError.value = { message: '请完善装柜仓库、物流渠道、真实运输资料和运输条款等必填信息' }")
|
||||
expect(source).toContain("actionError.value = { message: '发货人、收货人和通知人名称均为必填项' }")
|
||||
expect(source).toContain('规格(必填)')
|
||||
expect(source).toContain('placeholder="单位名称(必填)"')
|
||||
})
|
||||
|
||||
it('does not expose the removed draft submission lifecycle', () => {
|
||||
expect(source).not.toContain("submit: '提交'")
|
||||
expect(source).not.toContain("confirm: '确认订舱'")
|
||||
expect(source).not.toContain("fail: '标记失败'")
|
||||
expect(source).not.toContain("status === 'DRAFT'")
|
||||
expect(source).not.toContain('updateOceanBooking')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user