forked from rehypejs/rehype-minify
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (30 loc) · 790 Bytes
/
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
import test from 'tape'
import {rehype} from 'rehype'
import {u} from 'unist-builder'
import {h} from 'hastscript'
import min from './index.js'
test('rehype-remove-comments', (t) => {
t.deepEqual(
rehype()
.use(min)
.runSync(u('root', [h('div', [{type: 'comment', value: 'foo'}])])),
u('root', [h('div')])
)
t.deepEqual(
rehype()
.use(min)
.runSync(
u('root', [h('div', [{type: 'comment', value: '[if IE]>…<![endif]'}])])
),
u('root', [h('div', [{type: 'comment', value: '[if IE]>…<![endif]'}])])
)
t.deepEqual(
rehype()
.use(min, {removeConditional: true})
.runSync(
u('root', [h('div', [{type: 'comment', value: '[if IE]>…<![endif]'}])])
),
u('root', [h('div')])
)
t.end()
})