Skip to content

Commit

Permalink
fix: failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
rigor789 committed Jul 16, 2020
1 parent e914f70 commit 3ec5de9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/compiler/__tests__/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
locStub,
Namespaces,
ElementTypes,
VNodeCall
VNodeCall,
} from '../src'
import { isString, PatchFlags, PatchFlagNames, isArray } from '@vue/shared'

Expand All @@ -19,21 +19,21 @@ const bracketsRE = /^\[|\]$/g
export function createObjectMatcher(obj: Record<string, any>) {
return {
type: NodeTypes.JS_OBJECT_EXPRESSION,
properties: Object.keys(obj).map(key => ({
properties: Object.keys(obj).map((key) => ({
type: NodeTypes.JS_PROPERTY,
key: {
type: NodeTypes.SIMPLE_EXPRESSION,
content: key.replace(bracketsRE, ''),
isStatic: !leadingBracketRE.test(key)
isStatic: !leadingBracketRE.test(key),
},
value: isString(obj[key])
? {
type: NodeTypes.SIMPLE_EXPRESSION,
content: obj[key].replace(bracketsRE, ''),
isStatic: !leadingBracketRE.test(obj[key])
isStatic: !leadingBracketRE.test(obj[key]),
}
: obj[key]
}))
: obj[key],
})),
}
}

Expand Down Expand Up @@ -62,19 +62,19 @@ export function createElementWithCodegen(
dynamicProps,
directives: undefined,
isBlock: false,
isForBlock: false,
loc: locStub
}
disableTracking: false,
loc: locStub,
},
}
}

export function genFlagText(flag: PatchFlags | PatchFlags[]) {
if (isArray(flag)) {
let f = 0
flag.forEach(ff => {
flag.forEach((ff) => {
f |= ff
})
return `${f} /* ${flag.map(f => PatchFlagNames[f]).join(', ')} */`
return `${f} /* ${flag.map((f) => PatchFlagNames[f]).join(', ')} */`
} else {
return `${flag} /* ${PatchFlagNames[flag]} */`
}
Expand Down

0 comments on commit 3ec5de9

Please sign in to comment.