mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-27 02:01:15 +08:00
test(components): [button] add test cases for using props of form and form-item (#13726)
test(components): add test cases for using props of form and form-item add case for using size and disabled from form add case for using size from form-item
This commit is contained in:
parent
93b230166c
commit
4515023c40
@ -3,6 +3,7 @@ import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it, test } from 'vitest'
|
||||
import { Loading, Search } from '@element-plus/icons-vue'
|
||||
|
||||
import Form from '@element-plus/components/form'
|
||||
import Button from '../src/button.vue'
|
||||
import ButtonGroup from '../src/button-group.vue'
|
||||
import type { ComponentSize } from '@element-plus/constants'
|
||||
@ -259,4 +260,35 @@ describe('Button Group', () => {
|
||||
'el-button__text--expand'
|
||||
)
|
||||
})
|
||||
|
||||
it('shoule use props of form', async () => {
|
||||
const wrapper = mount({
|
||||
setup: () => () =>
|
||||
(
|
||||
<Form size="large" disabled>
|
||||
<Button>{{ AXIOM }}</Button>
|
||||
</Form>
|
||||
),
|
||||
})
|
||||
const btn = wrapper.findComponent(Button)
|
||||
expect(btn.classes()).toContain('el-button--large')
|
||||
expect(btn.classes()).toContain('is-disabled')
|
||||
await btn.trigger('click')
|
||||
expect(btn.emitted('click')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('shoule use size of form-item', async () => {
|
||||
const wrapper = mount({
|
||||
setup: () => () =>
|
||||
(
|
||||
<Form size="large" disabled>
|
||||
<Form.FormItem size="small">
|
||||
<Button>{{ AXIOM }}</Button>
|
||||
</Form.FormItem>
|
||||
</Form>
|
||||
),
|
||||
})
|
||||
const btn = wrapper.findComponent(Button)
|
||||
expect(btn.classes()).toContain('el-button--small')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user