test: tests for hoistStatic

This commit is contained in:
Evan You
2019-10-07 17:12:22 -04:00
parent 802ecccc49
commit 57a5c61320
9 changed files with 655 additions and 83 deletions

View File

@@ -7,7 +7,7 @@ import {
ElementCodegenNode
} from '../src'
import { CREATE_VNODE } from '../src/runtimeHelpers'
import { isString } from '@vue/shared'
import { isString, PatchFlags, PatchFlagNames, isArray } from '@vue/shared'
const leadingBracketRE = /^\[/
const bracketsRE = /^\[|\]$/g
@@ -58,3 +58,15 @@ export function createElementWithCodegen(
}
}
}
export function genFlagText(flag: PatchFlags | PatchFlags[]) {
if (isArray(flag)) {
let f = 0
flag.forEach(ff => {
f |= ff
})
return `${f} /* ${flag.map(f => PatchFlagNames[f]).join(', ')} */`
} else {
return `${flag} /* ${PatchFlagNames[flag]} */`
}
}