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