Просмотр исходного кода

test(vue): add config.compilerOptions.isCustomElement test (#4682)

Che Guevara 4 лет назад
Родитель
Сommit
d84d5ecdbd
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      packages/vue/__tests__/index.spec.ts

+ 11 - 1
packages/vue/__tests__/index.spec.ts

@@ -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: () => ({