forked from rehypejs/rehype-minify
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
51 lines (46 loc) · 1.04 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
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-style-type-css', (t) => {
t.deepEqual(
rehype()
.use(min)
.runSync(u('root', [h('link', {rel: ['stylesheet'], type: 'text/css'})])),
u('root', [
{
type: 'element',
tagName: 'link',
properties: {rel: ['stylesheet'], type: null},
children: []
}
])
)
t.deepEqual(
rehype()
.use(min)
.runSync(u('root', [h('style', {type: 'text/css'})])),
u('root', [
{
type: 'element',
tagName: 'style',
properties: {type: null},
children: []
}
])
)
t.deepEqual(
rehype()
.use(min)
.runSync(u('root', [h('link', {type: 'foostyle'})])),
u('root', [h('link', {type: 'foostyle'})])
)
t.deepEqual(
rehype()
.use(min)
.runSync(u('root', [h('style', {type: 'foostyle'})])),
u('root', [h('style', {type: 'foostyle'})])
)
t.end()
})