customizedBuiltIn.spec.ts 647 B

1234567891011121314151617181920
  1. import { render, h } from '@vue/runtime-dom'
  2. describe('customized built-in elements support', () => {
  3. let createElement: jest.SpyInstance
  4. afterEach(() => {
  5. createElement.mockRestore()
  6. })
  7. test('should created element with is option', () => {
  8. const root = document.createElement('div')
  9. createElement = jest.spyOn(document, 'createElement')
  10. render(h('button', { is: 'plastic-button' }), root)
  11. expect(createElement.mock.calls[0]).toMatchObject([
  12. 'button',
  13. { is: 'plastic-button' }
  14. ])
  15. // should also render the attribute
  16. expect(root.innerHTML).toBe(`<button is="plastic-button"></button>`)
  17. })
  18. })