test(components): [select] fix test warning (#18211)

This commit is contained in:
tangyongjie 2024-09-07 07:54:26 +08:00 committed by GitHub
parent 7633b1f7e9
commit 271385f6a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 9 deletions

View File

@ -2,6 +2,7 @@ import { defineComponent, nextTick } from 'vue'
import { mount } from '@vue/test-utils'
import { afterEach, describe, it } from 'vitest'
import Options from '../src/options'
import Select from '../src/select.vue'
import type { PropType } from 'vue'
import type { VueWrapper } from '@vue/test-utils'
@ -33,15 +34,22 @@ describe('options', () => {
const samples = Array.from({ length: 3 })
const createWrapper = (slots = {}) => {
wrapper = mount((_, { slots }) => <Options>{slots?.default?.()}</Options>, {
global: {
components: {
ElOption: ElOptionStub,
ElOptionGroup: ElOptionGroupStub,
wrapper = mount(
(_, { slots }) => (
<Select>
<Options>{slots?.default?.()}</Options>
</Select>
),
{
global: {
components: {
ElOption: ElOptionStub,
ElOptionGroup: ElOptionGroupStub,
},
},
},
slots,
}) as VueWrapper<any>
slots,
}
) as VueWrapper<any>
}
afterEach(() => {

View File

@ -2718,7 +2718,6 @@ describe('Select', () => {
>
<el-option value="1">1</el-option>
<el-option value="2">2</el-option>
</el-option>
</el-select>
`,
() => ({