fix(core): fix unit testing warning (#4948)

This commit is contained in:
Herrington Darkholme 2021-12-26 02:08:04 -05:00 committed by GitHub
parent 28a1170ecd
commit b431838d60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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)
})
})

View File

@ -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', () => {

View File

@ -37,7 +37,7 @@ export const useSize = (
form?.size ||
globalConfig.value ||
globalConfigLegacy.size ||
''
'default'
)
}