20260924172548
This commit is contained in:
1 parent
0405cd198a
commit
27e49e2e45
22 files changed
+1786
-346
No files matched your search
@@ -64,15 +64,9 @@ const lastSchema = (wrapper) => {
|
||||
return events.length ? events[events.length - 1][0] : null
|
||||
}
|
||||
|
||||
/** 切到「工作队列页签」分节并返回该分节内的页签表格(Tabs 懒渲染:未激活过的分节无 DOM) */
|
||||
async function openViewsTab(wrapper) {
|
||||
const tab = wrapper
|
||||
.findAll('.tabs-tab')
|
||||
.find((button) => button.text().includes('工作队列页签'))
|
||||
await tab.trigger('click')
|
||||
await nextTick()
|
||||
const pane = wrapper.findAll('.tabs-pane').at(-1)
|
||||
return pane.findComponent(FmsTable)
|
||||
/** 「工作队列页签」分节内的页签表格(四个分节同页平铺,按分节类名定位) */
|
||||
function viewsTable(wrapper) {
|
||||
return wrapper.find('.mm-qdesign__section--views').findComponent(FmsTable)
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -80,6 +74,29 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('查询配置面板:加载不回写、编辑才回写', () => {
|
||||
it('四个分节同页平铺(不用页签分组),各自带一张定高表格', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
// 页签栏与页签面板都不应存在
|
||||
expect(wrapper.findAll('.tabs-tab').length, '不应再有页签').toBe(0)
|
||||
expect(wrapper.findAll('.tabs-pane').length, '不应再有页签面板').toBe(0)
|
||||
|
||||
const sections = wrapper.findAll('.mm-qdesign__section')
|
||||
expect(sections.map((section) => section.find('.mm-qdesign__section-title strong').text())).toEqual(
|
||||
['更多条件字段', '工作队列页签', '关键词字段', '快捷筛选字段'],
|
||||
)
|
||||
|
||||
// 三个带表格的分节:表格容器有按行数算出的显式高度(不再靠 flex 撑满整屏)
|
||||
for (const modifier of ['--fields', '--views', '--quick']) {
|
||||
const tableBox = wrapper.find(`.mm-qdesign__section${modifier} .mm-qdesign__table`)
|
||||
expect(tableBox.exists(), `${modifier} 分节应有表格容器`).toBe(true)
|
||||
expect(tableBox.attributes('style'), `${modifier} 分节表格应有显式高度`).toMatch(
|
||||
/height:\s*\d+px/,
|
||||
)
|
||||
expect(tableBox.findComponent(FmsTable).exists(), `${modifier} 分节应渲染表格`).toBe(true)
|
||||
}
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('仅加载(含父级重载换新对象)不回写', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
expect(lastSchema(wrapper)).toBe(null)
|
||||
@@ -93,7 +110,7 @@ describe('查询配置面板:加载不回写、编辑才回写', () => {
|
||||
|
||||
it('老结构条件在草稿里转成 SQL 展示,但加载本身不回写', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
const rows = (await openViewsTab(wrapper)).props('dataSource')
|
||||
const rows = viewsTable(wrapper).props('dataSource')
|
||||
expect(rows[0].conditionSql).toBe("[b_status] = N'1'")
|
||||
expect(rows[0].isDefault).toBe(true)
|
||||
expect(lastSchema(wrapper)).toBe(null)
|
||||
@@ -102,7 +119,7 @@ describe('查询配置面板:加载不回写、编辑才回写', () => {
|
||||
|
||||
it('改分组后回写为 schemaVersion 3(已废弃键被清理)', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
const table = await openViewsTab(wrapper)
|
||||
const table = viewsTable(wrapper)
|
||||
const rows = table.props('dataSource')
|
||||
rows[0].group = '状态'
|
||||
table.vm.$emit('change', rows[0], { dataIndex: 'group' })
|
||||
@@ -126,7 +143,7 @@ describe('查询配置面板:加载不回写、编辑才回写', () => {
|
||||
|
||||
it('页签条件改为 SQL 后回写', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
await openViewsTab(wrapper)
|
||||
viewsTable(wrapper)
|
||||
await wrapper.find('button.mm-qdesign__sql-cell').trigger('click')
|
||||
await nextTick()
|
||||
await wrapper.find('textarea').setValue("b_status = N'2'")
|
||||
@@ -142,7 +159,7 @@ describe('查询配置面板:加载不回写、编辑才回写', () => {
|
||||
|
||||
it('条件 SQL 含分号时不回写(拦截手误)', async () => {
|
||||
const wrapper = await mountPanel(legacySchema)
|
||||
await openViewsTab(wrapper)
|
||||
viewsTable(wrapper)
|
||||
await wrapper.find('button.mm-qdesign__sql-cell').trigger('click')
|
||||
await nextTick()
|
||||
await wrapper.find('textarea').setValue("b_status = N'2'; DELETE FROM x")
|
||||
|
||||
Reference in new issue
Block a user