]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(vue): add config.compilerOptions.isCustomElement test (#4682)
authorChe Guevara <836934184@qq.com>
Mon, 27 Sep 2021 14:52:59 +0000 (22:52 +0800)
committerGitHub <noreply@github.com>
Mon, 27 Sep 2021 14:52:59 +0000 (10:52 -0400)
packages/vue/__tests__/index.spec.ts

index 99e3a63a6ae0d715e8cc6ef4dad785d77847dd1a..a51c7fd97a9a08016e08c7a5ad4ee2a9893e7e2b 100644 (file)
@@ -131,7 +131,7 @@ describe('compiler + runtime integration', () => {
     ).toHaveBeenWarned()
   })
 
-  it('should support custom element', () => {
+  it('should support custom element via config.isCustomElement (deprecated)', () => {
     const app = createApp({
       template: '<custom></custom>'
     })
@@ -141,6 +141,16 @@ describe('compiler + runtime integration', () => {
     expect(container.innerHTML).toBe('<custom></custom>')
   })
 
+  it('should support custom element via config.compilerOptions.isCustomElement', () => {
+    const app = createApp({
+      template: '<custom></custom>'
+    })
+    const container = document.createElement('div')
+    app.config.compilerOptions.isCustomElement = tag => tag === 'custom'
+    app.mount(container)
+    expect(container.innerHTML).toBe('<custom></custom>')
+  })
+
   it('should support using element innerHTML as template', () => {
     const app = createApp({
       data: () => ({