fix(runtome-dom): properly support creating customized built-in element
This commit is contained in:
20
packages/runtime-dom/__tests__/customizedBuiltIn.spec.ts
Normal file
20
packages/runtime-dom/__tests__/customizedBuiltIn.spec.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { render, h } from '@vue/runtime-dom'
|
||||
|
||||
describe('customimized built-in elements support', () => {
|
||||
let createElement: jest.SpyInstance
|
||||
afterEach(() => {
|
||||
createElement.mockRestore()
|
||||
})
|
||||
|
||||
test('should created element with is option', () => {
|
||||
const root = document.createElement('div')
|
||||
createElement = jest.spyOn(document, 'createElement')
|
||||
render(h('button', { is: 'plastic-button' }), root)
|
||||
expect(createElement.mock.calls[0]).toMatchObject([
|
||||
'button',
|
||||
{ is: 'plastic-button' }
|
||||
])
|
||||
// should also render the attribute
|
||||
expect(root.innerHTML).toBe(`<button is="plastic-button"></button>`)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user