fix(admin): align supplier carrier master data
This commit is contained in:
@@ -48,14 +48,16 @@ describe('supplier formal pages', () => {
|
||||
expect(detailSource).toContain('<ApiErrorMeta')
|
||||
})
|
||||
|
||||
it('uses a fixed carrier-code selector for booking suppliers and shows the code in list and detail', () => {
|
||||
it('uses a fixed multi-select for booking supplier carrier codes and sends no legacy scalar', () => {
|
||||
expect(formSource).toContain('v-if="form.category === \'BOOKING\'"')
|
||||
expect(formSource).toContain('v-for="option in carrierCodeOptions"')
|
||||
expect(formSource).not.toContain('v-model="form.carrierCode" maxlength')
|
||||
expect(formSource).toContain("if (category !== 'BOOKING') form.carrierCode = null")
|
||||
expect(formSource).toContain("return form.category === 'BOOKING' ? { ...normalized, carrierCode } : normalized")
|
||||
expect(source).toContain("label: '船司标准编码'")
|
||||
expect(detailSource).toContain("['船司标准编码', formatCarrierCode(supplier.value.carrierCode)]")
|
||||
expect(formSource).toContain('v-model="form.carrierCodes" multiple')
|
||||
expect(formSource).toContain("if (category !== 'BOOKING') form.carrierCodes = []")
|
||||
expect(formSource).toContain("carrierCodes: [...(carrierCodes || [])]")
|
||||
expect(formSource).not.toMatch(/form\.carrierCode(?!s)/)
|
||||
expect(source).toContain("label: '可代理船公司'")
|
||||
expect(source).toContain("carrierCode: activeCategory.value === 'BOOKING' ? applied.value.carrierCode || undefined : undefined")
|
||||
expect(detailSource).toContain("['可代理船公司', supplier.value.category === 'BOOKING' ? formatCarrierCodes(supplier.value.carrierCodes) : '—']")
|
||||
})
|
||||
|
||||
it('reloads detail data when the reused route id changes and protects the newer request', () => {
|
||||
@@ -64,4 +66,12 @@ describe('supplier formal pages', () => {
|
||||
expect(detailSource).toContain('if (sequence !== loadSequence || requestedId !== supplierId.value) return')
|
||||
expect(detailSource).toContain("params: { id: supplier.id }")
|
||||
})
|
||||
|
||||
it('refreshes cached lists and resets cached create forms on activation', () => {
|
||||
expect(source).toContain('onMounted(load)')
|
||||
expect(source).toContain('if (activatedOnce) void load()')
|
||||
expect(formSource).toContain('if (activatedOnce) void load()')
|
||||
expect(formSource).toContain('onDeactivated(() => { active = false })')
|
||||
expect(formSource).toContain("watch(supplierId, () => { if (active) void load() }, { immediate: true })")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user