(
template: string,
expectedPatchFlag?: PatchFlags,
)
| 518 | |
| 519 | test('should only force dynamic slots when actually using scope vars w/ prefixIdentifiers: true', () => { |
| 520 | function assertDynamicSlots( |
| 521 | template: string, |
| 522 | expectedPatchFlag?: PatchFlags, |
| 523 | ) { |
| 524 | const { root } = parseWithSlots(template, { prefixIdentifiers: true }) |
| 525 | let flag: any |
| 526 | if (root.children[0].type === NodeTypes.FOR) { |
| 527 | const div = (root.children[0].children[0] as ElementNode) |
| 528 | .codegenNode as any |
| 529 | const comp = div.children[0] |
| 530 | flag = comp.codegenNode.patchFlag |
| 531 | } else { |
| 532 | const innerComp = (root.children[0] as ComponentNode) |
| 533 | .children[0] as ComponentNode |
| 534 | flag = (innerComp.codegenNode as VNodeCall).patchFlag |
| 535 | } |
| 536 | if (expectedPatchFlag) { |
| 537 | expect(flag).toBe(expectedPatchFlag) |
| 538 | } else { |
| 539 | expect(flag).toBeUndefined() |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | assertDynamicSlots( |
| 544 | `<div v-for="i in list"> |
no test coverage detected