停用显示修复
This commit is contained in:
parent
7f06b2ee58
commit
048b62766b
|
|
@ -398,7 +398,7 @@ describe('停用分类下的物料编辑', () => {
|
|||
const state = setupState(wrapper)
|
||||
const row = { id: 7, category_id: 12, category: 'A01', material_code: 'MAT-7', name: '原名称' }
|
||||
|
||||
expect(state.getMajorCategoryDisplay(row)).toBe('A 旧大类')
|
||||
expect(state.getMajorCategoryDisplay(row)).toBe('A 旧大类(已停用)')
|
||||
expect(state.getMinorCategoryDisplay(row)).toBe('旧小类')
|
||||
|
||||
state.showEditModal(row)
|
||||
|
|
@ -407,11 +407,27 @@ describe('停用分类下的物料编辑', () => {
|
|||
expect(state.form.category_id).toBe(12)
|
||||
expect(state.majorCategories.map(category => category.id)).toContain(1)
|
||||
expect(state.minorCategories.map(category => category.id)).toContain(12)
|
||||
expect(state.categoryLabel(state.minorCategories.find(category => category.id === 12))).toBe('旧小类(已停用)')
|
||||
expect(state.minorCategoryLabel(state.minorCategories.find(category => category.id === 12), 1)).toBe('旧小类')
|
||||
|
||||
state.form.name = '新名称'
|
||||
await state.handleSave()
|
||||
expect(materialsStore.updateMaterial).toHaveBeenCalledWith(7, expect.objectContaining({ category_id: 12, name: '新名称' }))
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
test('只有小类停用时在小类名称后标注', async () => {
|
||||
materialCategoriesApi.list.mockResolvedValue({ data: [
|
||||
{ id: 1, code: 'A', name: '机械结构类', parent_id: null, status: 'active' },
|
||||
{ id: 12, code: 'A01', name: '标准件', parent_id: 1, status: 'inactive' }
|
||||
] })
|
||||
unitsApi.list.mockResolvedValue({ data: [] })
|
||||
const wrapper = mountMaterials()
|
||||
await flushPromises()
|
||||
const state = setupState(wrapper)
|
||||
const row = { category_id: 12, category: 'A01' }
|
||||
|
||||
expect(state.getMajorCategoryDisplay(row)).toBe('A 机械结构类')
|
||||
expect(state.getMinorCategoryDisplay(row)).toBe('标准件(已停用)')
|
||||
wrapper.unmount()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user