Skip to content

Commit f8e2361

Browse files
committed
wip: make tests pass again
1 parent 18cf63f commit f8e2361

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

packages/runtime-core/src/compat/compatConfig.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,13 @@ export function softAssertCompatEnabled(key: DeprecationTypes, ...args: any[]) {
4141
}
4242
return isCompatEnabled(key)
4343
}
44+
45+
// disable features that conflict with v3 behavior
46+
if (__TEST__) {
47+
configureCompat({
48+
COMPONENT_ASYNC: { enabled: false },
49+
COMPONENT_FUNCTIONAL: { enabled: false },
50+
WATCH_ARRAY: { enabled: false },
51+
INSTANCE_ATTRS_CLASS_STYLE: { enabled: false }
52+
})
53+
}

packages/runtime-core/src/compat/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isArray, isFunction, isObject, isPromise } from '@vue/shared/src'
1+
import { isArray, isFunction, isObject, isPromise } from '@vue/shared'
22
import { defineAsyncComponent } from '../apiAsyncComponent'
33
import { Component, ComponentOptions, FunctionalComponent } from '../component'
44
import { isVNode } from '../vnode'

packages/runtime-core/src/componentEmits.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function emit(
5757
propsOptions: [propsOptions]
5858
} = instance
5959
if (emitsOptions) {
60-
if (!(event in emitsOptions)) {
60+
if (!(event in emitsOptions) && !event.startsWith('hook:')) {
6161
if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
6262
warn(
6363
`Component emitted event "${event}" but it is neither declared in ` +

packages/runtime-dom/src/directives/vOn.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@ export const withKeys = (fn: Function, modifiers: string[]) => {
6060
let globalKeyCodes: LegacyConfig['keyCodes']
6161
if (__COMPAT__) {
6262
if (compatUtils.isCompatEnabled(DeprecationTypes.CONFIG_KEY_CODES)) {
63-
globalKeyCodes = ((getCurrentInstance()!.appContext
64-
.config as any) as LegacyConfig).keyCodes
63+
const instance = getCurrentInstance()
64+
if (instance) {
65+
globalKeyCodes = ((instance.appContext.config as any) as LegacyConfig)
66+
.keyCodes
67+
}
6568
}
6669
if (__DEV__ && modifiers.some(m => /^\d+$/.test(m))) {
6770
compatUtils.warnDeprecation(DeprecationTypes.V_ON_KEYCODE_MODIFIER)

0 commit comments

Comments
 (0)