20260917212907
This commit is contained in:
1 parent
6fa3d8535e
commit
5cbf745bbf
115 files changed
+4104
-85
No files matched your search
@@ -1,10 +1,11 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { afterEach, 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'
|
||||
import FmsField from '@/components/fms-field/FmsField.vue'
|
||||
import { resetUIConfig, setUIConfig } from '@/components/ui'
|
||||
|
||||
/** 构造一个查询条件项(字段 + 配置),供工具栏布局用例复用 */
|
||||
const queryItem = (field) => ({
|
||||
@@ -20,6 +21,7 @@ const rangeQueryItem = (bType) => ({
|
||||
|
||||
describe('fms-module-list components', () => {
|
||||
beforeEach(() => setActivePinia(createPinia()))
|
||||
afterEach(() => resetUIConfig())
|
||||
|
||||
it('mounts a text query control with the new UI kit', () => {
|
||||
const wrapper = mount(FmsQueryControl, {
|
||||
@@ -40,6 +42,32 @@ describe('fms-module-list components', () => {
|
||||
expect(wrapper.html()).not.toContain('<a-')
|
||||
})
|
||||
|
||||
it('条件字段用 FormItem 渲染,label 排版跟随全局布局配置', () => {
|
||||
const mountToolbar = () =>
|
||||
mount(FmsQueryToolbar, {
|
||||
props: {
|
||||
queryItems: [queryItem('b_name')],
|
||||
queryLayout: { area: { b_name: 'quick' }, order: { b_name: 10 } },
|
||||
},
|
||||
})
|
||||
|
||||
// 中文(默认):横排,label 在左
|
||||
const zh = mountToolbar()
|
||||
const item = zh.find('.query-field')
|
||||
expect(item.classes()).toContain('fms-form-item')
|
||||
expect(item.classes()).not.toContain('fms-form-item-vertical')
|
||||
expect(item.find('.fms-form-item-label').text()).toBe('b_name')
|
||||
// 定宽标签会在短标签后拖出一段空白,查询区按内容收缩
|
||||
expect(item.find('.fms-form-item-label').attributes('style')).toContain('width: auto')
|
||||
zh.unmount()
|
||||
|
||||
// 切到非中文:竖排,label 在上
|
||||
setUIConfig({ form: { layout: 'vertical' } })
|
||||
const en = mountToolbar()
|
||||
expect(en.find('.query-field').classes()).toContain('fms-form-item-vertical')
|
||||
en.unmount()
|
||||
})
|
||||
|
||||
it('查询条件网格列数按条件数收缩(只有一个条件时不占 4 列宽)', () => {
|
||||
const one = mount(FmsQueryToolbar, {
|
||||
props: {
|
||||
|
||||
Reference in new issue
Block a user