fix(runtime-core): fix null type in required + multi-type prop declarations
fix #4146 (in combination with #4147)
This commit is contained in:
@@ -556,4 +556,21 @@ describe('component props', () => {
|
||||
await nextTick()
|
||||
expect(serializeInner(root)).toBe(`foo`)
|
||||
})
|
||||
|
||||
test('support null in required + multiple-type declarations', () => {
|
||||
const Comp = {
|
||||
props: {
|
||||
foo: { type: [Function, null], required: true }
|
||||
},
|
||||
render() {}
|
||||
}
|
||||
const root = nodeOps.createElement('div')
|
||||
expect(() => {
|
||||
render(h(Comp, { foo: () => {} }), root)
|
||||
}).not.toThrow()
|
||||
|
||||
expect(() => {
|
||||
render(h(Comp, { foo: null }), root)
|
||||
}).not.toThrow()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user