revert(module-management): 撤回概览配置完成度 checklist(阶段三)
使用者试用后决定不要:清单信息与 tab 徽标(脏点/缺 N)重复,且占据概览篇幅。 revert 29f98494(组件、spec、index.vue 接线全部移除),计划文档记录该决策。 阶段一(脏点)与阶段二(表单设计缺 N 徽标)保留。
This commit is contained in:
1 parent
29f98494af
commit
2ab502b4a5
4 files changed
+5
-274
No files matched your search
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* 概览完成度清单(ModuleOverviewChecklist)测试:
|
||||
* - 条目随模块类型显隐(data 含表单设计,query 不含)
|
||||
* - 缺配/完整/空态文案(状态不只靠颜色,文案本身是断言对象)
|
||||
* - 条目点击与键盘 Enter 跳转对应分节;「一键补充」不冒泡为跳转
|
||||
*/
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import ModuleOverviewChecklist from '@/views/system/module-management/components/ModuleOverviewChecklist.vue'
|
||||
|
||||
function mountList(props) {
|
||||
return mount(ModuleOverviewChecklist, {
|
||||
props: {
|
||||
moduleType: 'data',
|
||||
fieldsEnabledCount: 5,
|
||||
editMissingCount: 0,
|
||||
listVisibleCount: 5,
|
||||
queryMissingCount: 0,
|
||||
powersCount: 3,
|
||||
...props,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function rowOf(wrapper, label) {
|
||||
return wrapper.findAll('.mm-checklist__item').find((item) => item.text().includes(label))
|
||||
}
|
||||
|
||||
describe('ModuleOverviewChecklist', () => {
|
||||
it('data 模块渲染全部条目,按依赖顺序排列', () => {
|
||||
const wrapper = mountList({})
|
||||
const labels = wrapper.findAll('.mm-checklist__label').map((el) => el.text())
|
||||
expect(labels).toEqual(['字段定义', '表单设计', '列表配置', '查询配置', '权限'])
|
||||
})
|
||||
|
||||
it('query 模块不渲染表单设计条目', () => {
|
||||
const wrapper = mountList({ moduleType: 'query' })
|
||||
const labels = wrapper.findAll('.mm-checklist__label').map((el) => el.text())
|
||||
expect(labels).toEqual(['字段定义', '列表配置', '查询配置', '权限'])
|
||||
})
|
||||
|
||||
it('缺配状态以文案表达:表单缺 N、查询缺 N 且提供一键补充', () => {
|
||||
const wrapper = mountList({ editMissingCount: 2, queryMissingCount: 3 })
|
||||
expect(rowOf(wrapper, '表单设计').text()).toContain('缺 2 项未布局')
|
||||
const queryRow = rowOf(wrapper, '查询配置')
|
||||
expect(queryRow.text()).toContain('缺 3 项')
|
||||
expect(queryRow.find('button').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('完整状态文案与无补充按钮', () => {
|
||||
const wrapper = mountList({})
|
||||
expect(rowOf(wrapper, '表单设计').text()).toContain('均已布局')
|
||||
expect(rowOf(wrapper, '查询配置').text()).toContain('完整')
|
||||
expect(wrapper.find('button').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('空态提示:无启用字段时引导先定义字段', () => {
|
||||
const wrapper = mountList({ fieldsEnabledCount: 0, editMissingCount: 0, listVisibleCount: 0, powersCount: 0 })
|
||||
expect(rowOf(wrapper, '字段定义').text()).toContain('先去定义字段')
|
||||
expect(rowOf(wrapper, '列表配置').text()).toContain('暂无可见列')
|
||||
expect(rowOf(wrapper, '权限').text()).toContain('尚未配置权限')
|
||||
})
|
||||
|
||||
it('条目点击与 Enter 均触发 navigate,携带对应分节 key', async () => {
|
||||
const wrapper = mountList({})
|
||||
await rowOf(wrapper, '字段定义').trigger('click')
|
||||
await rowOf(wrapper, '查询配置').trigger('keydown', { key: 'Enter' })
|
||||
expect(wrapper.emitted('navigate')).toEqual([['fields'], ['query']])
|
||||
})
|
||||
|
||||
it('一键补充按钮触发 fill-missing 且不触发 navigate', async () => {
|
||||
const wrapper = mountList({ queryMissingCount: 3 })
|
||||
await rowOf(wrapper, '查询配置').find('button').trigger('click')
|
||||
expect(wrapper.emitted('fill-missing')).toHaveLength(1)
|
||||
expect(wrapper.emitted('navigate')).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user