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

This commit is contained in:
Che Guevara 2021-09-27 22:52:59 +08:00 committed by GitHub
parent 3f5f98dcf5
commit d84d5ecdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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