tangled
alpha
login
or
join now
tombl.dev
/
dhtml
1
fork
atom
a post-component library for building user-interfaces on the web.
1
fork
atom
overview
issues
pulls
pipelines
test: style tests slightly
tombl.dev
1 year ago
13b0fa2f
c4b68648
verified
This commit was signed with the committer's
known signature
.
tombl.dev
SSH Key Fingerprint:
SHA256:d8AHgL5V+3WdvGdDb3SVBfb0RIRJfkKcqhQ5aG1mVNk=
+13
-2
1 changed file
expand all
collapse all
unified
split
test
setup.ts
+13
-2
test/setup.ts
reviewed
···
1
1
/// <reference types='vite/client' />
2
2
/// <reference types='@vitest/browser/matchers' />
3
3
4
4
+
import '../reset.css'
5
5
+
4
6
import { Root } from 'dhtml'
5
5
-
import { afterEach } from 'vitest'
7
7
+
import { afterEach, expect } from 'vitest'
6
8
7
9
const roots: Root[] = []
8
10
9
11
export function setup(initialHtml = '') {
12
12
+
const state = expect.getState()
13
13
+
const parentEl = document.createElement('div')
14
14
+
Object.assign(parentEl.style, {
15
15
+
border: '1px solid black',
16
16
+
padding: '0.5em',
17
17
+
margin: '0.5em',
18
18
+
})
19
19
+
parentEl.appendChild(document.createElement('small')).textContent = state.currentTestName ?? 'test'
20
20
+
10
21
const el = document.createElement('div')
11
22
el.innerHTML = initialHtml
12
12
-
document.body.appendChild(el)
23
23
+
document.body.appendChild(parentEl).appendChild(el)
13
24
14
25
const root = Root.appendInto(el)
15
26
roots.push(root)