Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-vapor-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Nov 26, 2023
2 parents 3fcd696 + df0f627 commit 62b51aa
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions packages/runtime-vapor/__tests__/template.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,28 @@
* @vitest-environment jsdom
*/

import { template } from '../src'
import { template, fragment } from '../src'

describe('api: template', () => {
test('create element', () => {
const t = template('<div>')
const div = t()
expect(div).toBeInstanceOf(HTMLDivElement)
const root = t()
expect(root).toBeInstanceOf(DocumentFragment)
expect(root.childNodes[0]).toBeInstanceOf(HTMLDivElement)

const div2 = t()
expect(div2).toBeInstanceOf(HTMLDivElement)
expect(div2).not.toBe(div)
expect(div2).toBeInstanceOf(DocumentFragment)
expect(div2).not.toBe(root)
})

test('create fragment', () => {
const frag = fragment()
const root = frag()
expect(root).toBeInstanceOf(DocumentFragment)
expect(root.childNodes.length).toBe(0)

const div2 = frag()
expect(div2).toBeInstanceOf(DocumentFragment)
expect(div2).not.toBe(root)
})
})

0 comments on commit 62b51aa

Please sign in to comment.