import { h, render, nodeOps, TestElement, serializeInner as inner } from '@vue/runtime-test' describe('renderer: element', () => { let root: TestElement beforeEach(() => { root = nodeOps.createElement('div') }) it('should create an element', () => { render(h('div'), root) expect(inner(root)).toBe('
') }) it('should create an element with props', () => { render(h('div', { id: 'foo', class: 'bar' }), root) expect(inner(root)).toBe('
') }) it('should create an element with direct text children', () => { render(h('div', ['foo', ' ', 'bar']), root) expect(inner(root)).toBe('
foo bar
') }) it('should create an element with direct text children and props', () => { render(h('div', { id: 'foo' }, ['bar']), root) expect(inner(root)).toBe('
bar
') }) it('should update an element tag which is already mounted', () => { render(h('div', ['foo']), root) expect(inner(root)).toBe('
foo
') render(h('span', ['foo']), root) expect(inner(root)).toBe('foo') }) it('should update element props which is already mounted', () => { render(h('div', { id: 'bar' }, ['foo']), root) expect(inner(root)).toBe('
foo
') render(h('div', { id: 'baz', class: 'bar' }, ['foo']), root) expect(inner(root)).toBe('
foo
') }) })