}
return isCompatEnabled(key)
}
+
+// disable features that conflict with v3 behavior
+if (__TEST__) {
+ configureCompat({
+ COMPONENT_ASYNC: { enabled: false },
+ COMPONENT_FUNCTIONAL: { enabled: false },
+ WATCH_ARRAY: { enabled: false },
+ INSTANCE_ATTRS_CLASS_STYLE: { enabled: false }
+ })
+}
-import { isArray, isFunction, isObject, isPromise } from '@vue/shared/src'
+import { isArray, isFunction, isObject, isPromise } from '@vue/shared'
import { defineAsyncComponent } from '../apiAsyncComponent'
import { Component, ComponentOptions, FunctionalComponent } from '../component'
import { isVNode } from '../vnode'
propsOptions: [propsOptions]
} = instance
if (emitsOptions) {
- if (!(event in emitsOptions)) {
+ if (!(event in emitsOptions) && !event.startsWith('hook:')) {
if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
warn(
`Component emitted event "${event}" but it is neither declared in ` +
let globalKeyCodes: LegacyConfig['keyCodes']
if (__COMPAT__) {
if (compatUtils.isCompatEnabled(DeprecationTypes.CONFIG_KEY_CODES)) {
- globalKeyCodes = ((getCurrentInstance()!.appContext
- .config as any) as LegacyConfig).keyCodes
+ const instance = getCurrentInstance()
+ if (instance) {
+ globalKeyCodes = ((instance.appContext.config as any) as LegacyConfig)
+ .keyCodes
+ }
}
if (__DEV__ && modifiers.some(m => /^\d+$/.test(m))) {
compatUtils.warnDeprecation(DeprecationTypes.V_ON_KEYCODE_MODIFIER)