fix(runtime-dom): catch more cases of DOM property setting error (#5552)
close #5545
This commit is contained in:
@@ -234,12 +234,29 @@ describe('runtime-dom: props patching', () => {
|
||||
expect(el.getAttribute('x')).toBe('2')
|
||||
})
|
||||
|
||||
test('input with size', () => {
|
||||
test('input with size (number property)', () => {
|
||||
const el = document.createElement('input')
|
||||
patchProp(el, 'size', null, 100)
|
||||
expect(el.size).toBe(100)
|
||||
patchProp(el, 'size', 100, null)
|
||||
expect(el.getAttribute('size')).toBe(null)
|
||||
expect('Failed setting prop "size" on <input>').toHaveBeenWarnedLast()
|
||||
})
|
||||
|
||||
test('select with type (string property)', () => {
|
||||
const el = document.createElement('select')
|
||||
patchProp(el, 'type', null, 'test')
|
||||
expect(el.type).toBe('select-one')
|
||||
expect('Failed setting prop "type" on <select>').toHaveBeenWarnedLast()
|
||||
})
|
||||
|
||||
test('select with willValidate (boolean property)', () => {
|
||||
const el = document.createElement('select')
|
||||
patchProp(el, 'willValidate', true, null)
|
||||
expect(el.willValidate).toBe(true)
|
||||
expect(
|
||||
'Failed setting prop "willValidate" on <select>'
|
||||
).toHaveBeenWarnedLast()
|
||||
})
|
||||
|
||||
test('patch value for select', () => {
|
||||
|
||||
Reference in New Issue
Block a user