mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 19:28:14 +08:00
fix(core): fix unit testing warning (#4948)
This commit is contained in:
parent
28a1170ecd
commit
b431838d60
@ -324,7 +324,7 @@ export default defineComponent({
|
||||
)
|
||||
const realSize = useSize()
|
||||
const tagSize = computed(() =>
|
||||
['small'].includes(realSize.value) ? 'small' : ''
|
||||
['small'].includes(realSize.value) ? 'small' : 'default'
|
||||
)
|
||||
const multiple = computed(() => !!props.props.multiple)
|
||||
const readonly = computed(() => !props.filterable || multiple.value)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { nextTick } from 'vue'
|
||||
import { mount } from '@vue/test-utils'
|
||||
import ElTag from '@element-plus/components/tag'
|
||||
import Descriptions from '../src/index.vue'
|
||||
import DescriptionsItem from '../src/description-item'
|
||||
|
||||
@ -8,6 +9,7 @@ const _mount = (template: string, data?: () => void, methods?: any) =>
|
||||
components: {
|
||||
'el-descriptions': Descriptions,
|
||||
'el-descriptions-item': DescriptionsItem,
|
||||
'el-tag': ElTag,
|
||||
},
|
||||
template,
|
||||
data,
|
||||
@ -196,6 +198,6 @@ describe('Descriptions.vue', () => {
|
||||
)
|
||||
wrapper.find('button').trigger('click')
|
||||
await nextTick()
|
||||
expect(wrapper.find('el-tag').text()).toBe(CHANGE_VALUE)
|
||||
expect(wrapper.findComponent(ElTag).text()).toBe(CHANGE_VALUE)
|
||||
})
|
||||
})
|
||||
|
@ -44,7 +44,7 @@ const getButtonVm = (wrapper: ReturnType<typeof mountComponent>) => {
|
||||
describe('use-form-item', () => {
|
||||
it('should return local value', () => {
|
||||
const wrapper = mountComponent()
|
||||
expect(getButtonVm(wrapper).buttonSize).toBe('')
|
||||
expect(getButtonVm(wrapper).buttonSize).toBe('default')
|
||||
})
|
||||
|
||||
it('should return props.size instead of injected.size', () => {
|
||||
|
@ -37,7 +37,7 @@ export const useSize = (
|
||||
form?.size ||
|
||||
globalConfig.value ||
|
||||
globalConfigLegacy.size ||
|
||||
''
|
||||
'default'
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user