]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: make tests pass again
authorEvan You <yyx990803@gmail.com>
Thu, 8 Apr 2021 20:33:53 +0000 (16:33 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 8 Apr 2021 20:33:53 +0000 (16:33 -0400)
packages/runtime-core/src/compat/compatConfig.ts
packages/runtime-core/src/compat/component.ts
packages/runtime-core/src/componentEmits.ts
packages/runtime-dom/src/directives/vOn.ts

index 201bc14a15c84ee8e2f7cccb13a7e504727f27d7..d8508853db55a937ec6273310dc54ddb90551266 100644 (file)
@@ -41,3 +41,13 @@ export function softAssertCompatEnabled(key: DeprecationTypes, ...args: any[]) {
   }
   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 }
+  })
+}
index ca15a6571364dfd1f1eb23d163463578a45791d0..6168c3e75fd21c3e047f73e4822fee0661087e51 100644 (file)
@@ -1,4 +1,4 @@
-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'
index 73cd2b70e04b77776e7fab5b507114cfd8614b58..a4ffdf89b35a2cb2352c4f7c81318b144fee2a64 100644 (file)
@@ -57,7 +57,7 @@ export function emit(
       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 ` +
index 665214b766f477bda0609652b475ad37219c0262..4de92f1541f710b7de119fb2763e541a3e72340a 100644 (file)
@@ -60,8 +60,11 @@ export const withKeys = (fn: Function, modifiers: string[]) => {
   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)