소스 검색

test: test case for sfc parse options cache invalidation

Evan You 2 년 전
부모
커밋
274f6f71fc
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      packages/compiler-sfc/__tests__/parse.spec.ts

+ 12 - 0
packages/compiler-sfc/__tests__/parse.spec.ts

@@ -367,6 +367,18 @@ h1 { color: red }
       tag: 'hello',
       tagType: ElementTypes.ELEMENT,
     })
+
+    // test cache invalidation on different options
+    const { descriptor: d2 } = parse(`<template><hello/></template>`, {
+      templateParseOptions: {
+        isCustomElement: t => t !== 'hello',
+      },
+    })
+    expect(d2.template!.ast!.children[0]).toMatchObject({
+      type: NodeTypes.ELEMENT,
+      tag: 'hello',
+      tagType: ElementTypes.COMPONENT,
+    })
   })
 
   describe('warnings', () => {