-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathtest.js
47 lines (45 loc) · 1 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
'use strict'
const test = require('ava')
const rehype = require('rehype')
const h = require('@starptech/prettyhtml-hastscript')
const min = require('.')
test('rehype-sort-attributes', function(t) {
t.deepEqual(
rehype().stringify(
rehype()
.use(min)
.runSync(
h(
'p',
{
z: 'foo',
d: ['bar'],
c: 'foo',
b: 1,
a: 'foo',
2: 2,
1: 1,
'[foo]': 'foo'
},
[h('strong', { id: 'baz', className: ['qux'] }), h('em', { hidden: false, className: ['quux'] })]
)
)
),
rehype().stringify(
h(
'p',
{
1: 1,
2: 2,
'[foo]': 'foo',
a: 'foo',
b: 1,
c: 'foo',
d: ['bar'],
z: 'foo'
},
[h('strong', { className: ['qux'], id: 'baz' }), h('em', { hidden: false, className: ['quux'] })]
)
)
)
})