mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
test(components): [pagination/input] test case (#18080)
This commit is contained in:
parent
044f0afc1e
commit
344c218d01
@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { useLocale } from '@element-plus/hooks'
|
||||
import Chinese from '@element-plus/locale/lang/zh-cn'
|
||||
import English from '@element-plus/locale/lang/en'
|
||||
import { ElButton, ElMessage } from '@element-plus/components'
|
||||
import { ElButton, ElMessage, ElPagination } from '@element-plus/components'
|
||||
import { rAF } from '@element-plus/test-utils/tick'
|
||||
import {
|
||||
useGlobalComponentSettings,
|
||||
@ -281,5 +281,25 @@ describe('config-provider', () => {
|
||||
|
||||
expect(vm.size).toBe('small')
|
||||
})
|
||||
|
||||
// #18004
|
||||
it('dynamically modify global size configuration', async () => {
|
||||
const size = ref<ComponentSize>('small')
|
||||
const wrapper = mount(() => (
|
||||
<ConfigProvider size={size.value}>
|
||||
<ElButton />
|
||||
<ElPagination total={100} background={true} />
|
||||
</ConfigProvider>
|
||||
))
|
||||
const button = wrapper.findComponent(ElButton)
|
||||
const pagination = wrapper.findComponent(ElPagination)
|
||||
expect(button.vm.$el.className.includes('small')).toBe(true)
|
||||
expect(pagination.vm.$el.className.includes('small')).toBe(true)
|
||||
|
||||
size.value = 'large'
|
||||
await nextTick()
|
||||
expect(button.vm.$el.className.includes('large')).toBe(true)
|
||||
expect(pagination.vm.$el.className.includes('large')).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -48,10 +48,15 @@ describe('Input.vue', () => {
|
||||
expect(inputElm.element.value).toBe('')
|
||||
})
|
||||
|
||||
test('disabled', () => {
|
||||
test('disabled', async () => {
|
||||
const wrapper = mount(() => <Input disabled />)
|
||||
const inputElm = wrapper.find('input')
|
||||
expect(inputElm.element.disabled).not.toBeNull()
|
||||
|
||||
// trigger click should not focus #18012
|
||||
inputElm.trigger('click')
|
||||
await nextTick()
|
||||
expect(inputElm.element.className.includes('is-focus')).toBe(false)
|
||||
})
|
||||
|
||||
describe('test emoji', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user