})
})
+ //#12011
+ test('replace camelize with hyphenate to handle props key', () => {
+ const Comp = {
+ props: {
+ hasB4BProp: { type: Boolean, required: true },
+ },
+ setup() {
+ return () => null
+ },
+ }
+ render(
+ h('div', {}, [
+ h(Comp, {
+ 'has-b-4-b-prop': true,
+ }),
+ h(Comp, {
+ 'has-b4-b-prop': true,
+ }),
+ ]),
+ nodeOps.createElement('div'),
+ )
+ expect(`Missing required prop: "hasB4BProp"`).not.toHaveBeenWarned()
+ })
+
test('warn props mutation', () => {
let instance: ComponentInternalInstance
let setupProps: any
) {
const resolvedValues = toRaw(props)
const options = instance.propsOptions[0]
+ const camelizePropsKey = Object.keys(rawProps).map(key => camelize(key))
for (const key in options) {
let opt = options[key]
if (opt == null) continue
resolvedValues[key],
opt,
__DEV__ ? shallowReadonly(resolvedValues) : resolvedValues,
- !hasOwn(rawProps, key) && !hasOwn(rawProps, hyphenate(key)),
+ !camelizePropsKey.includes(key),
)
}
}