-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
53 lines (42 loc) · 1.58 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import assert from 'node:assert/strict'
import test from 'node:test'
import {h} from 'hastscript'
import {phrasing} from 'hast-util-phrasing'
import {u} from 'unist-builder'
test('phrasing()', async function (t) {
await t.test('should expose the public api', async function () {
assert.deepEqual(Object.keys(await import('hast-util-phrasing')).sort(), [
'phrasing'
])
})
await t.test('should support flow', async function () {
assert(!phrasing(h('div', 'Alpha')))
})
await t.test('should support meta w/ itemProp', async function () {
assert(phrasing(h('meta', {itemProp: 'bravo'})))
})
await t.test('should support meta w/o itemProp', async function () {
assert(!phrasing(h('meta', {charSet: 'utf8'})))
})
await t.test('should support text', async function () {
assert(phrasing(u('text', 'charlie')))
})
await t.test('should support inter-element whitespace', async function () {
assert(phrasing(u('text', '\n\t')))
})
await t.test('should support listed elements (a)', async function () {
assert(phrasing(h('a', {href: '/'}, 'Delta')))
})
await t.test('should support listed elements (b)', async function () {
assert(phrasing(h('b', {id: 'echo'}, 'Foxtrott')))
})
await t.test('should support listed elements (wbr)', async function () {
assert(phrasing(h('wbr')))
})
await t.test('should support embedded content', async function () {
assert(phrasing(h('svg')))
})
await t.test('should support body-ok links', async function () {
assert(phrasing(h('link', {rel: ['stylesheet'], href: 'index.css'})))
})
})