]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: test case for sfc parse options cache invalidation
authorEvan You <yyx990803@gmail.com>
Sat, 30 Dec 2023 13:09:15 +0000 (21:09 +0800)
committerEvan You <yyx990803@gmail.com>
Sat, 30 Dec 2023 13:09:15 +0000 (21:09 +0800)
packages/compiler-sfc/__tests__/parse.spec.ts

index 3d5ec8604b9e886d0e361af8cfac03dab6f2a254..048dab693aa85569b23b80d2293bc6cb468eb5bd 100644 (file)
@@ -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', () => {