MCPcopy
hub / github.com/vuejs/core / assertDynamicSlots

Function assertDynamicSlots

packages/compiler-core/__tests__/transforms/vSlot.spec.ts:520–541  ·  view source on GitHub ↗
(
      template: string,
      expectedPatchFlag?: PatchFlags,
    )

Source from the content-addressed store, hash-verified

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">

Callers 1

vSlot.spec.tsFile · 0.85

Calls 1

parseWithSlotsFunction · 0.70

Tested by

no test coverage detected