wip: compat test coverage

This commit is contained in:
Evan You
2021-04-30 18:05:03 -04:00
parent 324a00c85d
commit 80303bcf5a
4 changed files with 93 additions and 9 deletions

View File

@@ -113,7 +113,7 @@ export function compatH(
): VNode
export function compatH(
type: string | Component,
props?: LegacyVNodeProps,
props?: Data & LegacyVNodeProps,
children?: LegacyVNodeChildren
): VNode
@@ -190,16 +190,12 @@ function convertLegacyProps(
} else if (key === 'on' || key === 'nativeOn') {
const listeners = legacyProps[key]
for (const event in listeners) {
const handlerKey = convertLegacyEventKey(event)
let handlerKey = convertLegacyEventKey(event)
if (key === 'nativeOn') handlerKey += `Native`
const existing = converted[handlerKey]
const incoming = listeners[event]
if (existing !== incoming) {
if (existing) {
// for the rare case where the same handler is attached
// twice with/without .native modifier...
if (key === 'nativeOn' && String(existing) === String(incoming)) {
continue
}
converted[handlerKey] = [].concat(existing as any, incoming as any)
} else {
converted[handlerKey] = incoming
@@ -307,6 +303,7 @@ function convertLegacySlots(vnode: VNode): VNode {
}
export function defineLegacyVNodeProperties(vnode: VNode) {
/* istanbul ignore if */
if (
isCompatEnabled(
DeprecationTypes.RENDER_FUNCTION,