patchProp(el, 'onClick', null, 'test')
el.dispatchEvent(new Event('click'))
expect(
- '[Vue warn]: Wrong type passed to the event invoker, ' +
- 'did you maybe forget @ or : in front of your prop?' +
- '\nReceived onClick="test"',
+ `Wrong type passed as event handler to onClick - did you forget @ or : ` +
+ `in front of your prop?\nExpected function or array of functions, received type string.`,
).toHaveBeenWarned()
})
})
-import { NOOP, hyphenate, isArray, isFunction, isString } from '@vue/shared'
+import { NOOP, hyphenate, isArray, isFunction } from '@vue/shared'
import {
type ComponentInternalInstance,
ErrorCodes,
return value as EventValue
}
warn(
- `Wrong type passed to the event invoker, did you maybe forget @ or : ` +
- `in front of your prop?\nReceived ` +
- `${propName}=${isString(value) ? JSON.stringify(value) : `[${typeof value}]`}`,
+ `Wrong type passed as event handler to ${propName} - did you forget @ or : ` +
+ `in front of your prop?\nExpected function or array of functions, received type ${typeof value}.`,
)
return NOOP
}