Skip to content

Commit

Permalink
test: add test for variable attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Jan 25, 2024
1 parent e41d4be commit 243267d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ test('variable', async () => {
assert.is(out, '<p>hello world</p>')
})

test('variable attribute', async () => {
const checked = true
const tmp = html`<input
type="checkbox"
${() => (checked ? 'checked' : '')}
/>`
const out = renderToString(tmp)
assert.is(
out,
`<input
type="checkbox"
checked
/>`
)
})

test('reactive variable type string', async () => {
const rVar = reactive({ message: 'hello world' })
const tmp = html`<p>${rVar.message}</p>`
Expand Down

0 comments on commit 243267d

Please sign in to comment.