Skip to content

Commit 6a75f47

Browse files
committed
chapter's e2e tests ( 10_minimum_example/060_template_compiler)
1 parent 5f895dd commit 6a75f47

File tree

1 file changed

+26
-0
lines changed
  • book/impls/10_minimum_example/060_template_compiler/tests

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
2+
3+
import { createApp } from '../packages'
4+
5+
let host: HTMLElement
6+
const initHost = () => {
7+
host = document.createElement('div')
8+
host.setAttribute('id', 'host')
9+
document.body.appendChild(host)
10+
}
11+
beforeEach(() => initHost())
12+
afterEach(() => host.remove())
13+
14+
describe('10_minimum_example/060_template_compiler', () => {
15+
it('should render template option', () => {
16+
const app = createApp({
17+
template: `<b class="hello" style="color: red;">Hello World!!</b>`,
18+
})
19+
app.mount('#host')
20+
21+
expect(host.innerHTML).toBe(
22+
// prettier-ignore
23+
'<b class="hello" style="color: red;">Hello World!!</b>',
24+
)
25+
})
26+
})

0 commit comments

Comments
 (0)