20260913231607
This commit is contained in:
1 parent
f3ad727f1c
commit
c31329d387
179 files changed
+10846
-2684
No files matched your search
@@ -3,6 +3,7 @@ import { createPinia, setActivePinia } from 'pinia'
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import FmsQueryControl from '@/components/fms-module-list/FmsQueryControl.vue'
|
||||
import FmsQueryToolbar from '@/components/fms-module-list/FmsQueryToolbar.vue'
|
||||
import FmsAdvancedQueryPanel from '@/components/fms-module-list/FmsAdvancedQueryPanel.vue'
|
||||
|
||||
describe('fms-module-list components', () => {
|
||||
beforeEach(() => setActivePinia(createPinia()))
|
||||
@@ -25,4 +26,43 @@ describe('fms-module-list components', () => {
|
||||
expect(wrapper.find('.fms-query-toolbar').exists()).toBe(true)
|
||||
expect(wrapper.html()).not.toContain('<a-')
|
||||
})
|
||||
|
||||
it('高级查询行间连接符表达行与行的连接:≥2 项才出现,点击切换后一项的 join', async () => {
|
||||
const state = {
|
||||
nodes: [
|
||||
{ id: 'n1', join: 'and', field: 'name', operator: 'like', value: 'a' },
|
||||
{ id: 'n2', join: 'and', field: 'name', operator: 'like', value: 'b' },
|
||||
],
|
||||
groups: [],
|
||||
}
|
||||
const wrapper = mount(FmsAdvancedQueryPanel, {
|
||||
props: { open: true, items: [], modelValue: state },
|
||||
})
|
||||
|
||||
const pill = wrapper.find('.filter-joiner .joiner-pill')
|
||||
expect(pill.exists()).toBe(true)
|
||||
expect(pill.text()).toBe('且')
|
||||
|
||||
await pill.trigger('click')
|
||||
expect(state.nodes[1].join).toBe('or')
|
||||
expect(wrapper.find('.filter-joiner .joiner-pill').text()).toBe('或')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
it('只有 1 个条件时不显示行间连接符(没有连接对象),条件行直接可见', () => {
|
||||
const wrapper = mount(FmsAdvancedQueryPanel, {
|
||||
props: {
|
||||
open: true,
|
||||
items: [],
|
||||
modelValue: {
|
||||
logic: 'and',
|
||||
nodes: [{ id: 'n1', field: 'name', operator: 'like', value: '' }],
|
||||
groups: [],
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(wrapper.find('.filter-joiner').exists()).toBe(false)
|
||||
expect(wrapper.find('.filter-row').exists()).toBe(true)
|
||||
wrapper.unmount()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user