mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-05 04:37:47 +08:00
fix(input): add keydown event listener for textarea (#1723)
This commit is contained in:
parent
c3d1d14bdd
commit
a02737a78a
@ -445,6 +445,30 @@ describe('Input.vue', () => {
|
||||
expect(handleKeyup).toBeCalledTimes(1)
|
||||
})
|
||||
|
||||
describe('Textarea Events', () => {
|
||||
test('event:keydown', async () => {
|
||||
const handleKeydown = jest.fn()
|
||||
const wrapper = _mount({
|
||||
template: `<el-input
|
||||
type="textarea"
|
||||
:model-value="val"
|
||||
@keydown="handleKeydown"
|
||||
/>`,
|
||||
setup() {
|
||||
const val = ref('')
|
||||
|
||||
return {
|
||||
val,
|
||||
handleKeydown,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
await wrapper.find('textarea').trigger('keydown')
|
||||
expect(handleKeydown).toBeCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: validateEvent & input containes select cases should be added after the rest components finished
|
||||
// ...
|
||||
|
||||
|
@ -98,6 +98,7 @@
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
@change="handleChange"
|
||||
@keydown="handleKeydown"
|
||||
>
|
||||
</textarea>
|
||||
<span v-if="isWordLimitVisible && type === 'textarea'" class="el-input__count">{{ textLength }}/{{ upperLimit }}</span>
|
||||
|
Loading…
Reference in New Issue
Block a user