let { morph } = require('@alpinejs/morph') let createElement = require('./createElement.js') test('text content', () => assertPatch( `
foo
`, `
bar
` )) test('change tag', () => assertPatch( `
foo
`, `
foo
` )) test('add child', () => assertPatch( `
foo
`, `
foo

baz

` )) test('remove child', () => assertPatch( `
foo

baz

`, `
foo
` )) test('add attribute', () => assertPatch( `
foo
`, `
foo
` )) test('remove attribute', () => assertPatch( `
foo
`, `
foo
` )) test('change attribute', () => assertPatch( `
foo
`, `
foo
` )) async function assertPatch(before, after) { expect((await morph(createElement(before), after)).outerHTML).toEqual(after) }