test: add test

This commit is contained in:
Nolan Lawson 2024-03-21 18:38:00 -07:00
parent 5cdc413987
commit 3b59a62957
1 changed files with 18 additions and 0 deletions

View File

@ -58,6 +58,24 @@ describe('framework', () => {
expect(node.outerHTML).toBe('<div><span>foo</span></div>')
})
test('dynamic expression with whitespace around it - minifier should be working', () => {
const state = { name: 'foo' }
const { html } = createFramework(state)
let node
const render = () => {
node = html`<div> ${state.name}\t\n</div>`
}
render()
expect(node.outerHTML).toBe('<div>foo</div>')
state.name = 'baz'
render()
expect(node.outerHTML).toBe('<div>baz</div>')
})
// Framework no longer supports this since we switched from HTML comments to text nodes
test.skip('render two dynamic expressions inside the same element', () => {
const state = { name1: 'foo', name2: 'bar' }