Skip to content

Commit 202f640

Browse files
committed
Update dev-dependencies
1 parent 31febd8 commit 202f640

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"@types/tape": "^4.0.0",
4343
"c8": "^7.0.0",
4444
"deepmerge": "^4.0.0",
45-
"hast-util-to-html": "^7.0.0",
45+
"hast-util-to-html": "^8.0.0",
4646
"hastscript": "^7.0.0",
4747
"prettier": "^2.0.0",
4848
"remark-cli": "^9.0.0",

test.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'tape'
2-
import html from 'hast-util-to-html'
2+
import {toHtml} from 'hast-util-to-html'
33
import {h, s} from 'hastscript'
44
import {u} from 'unist-builder'
55
import deepmerge from 'deepmerge'
@@ -12,21 +12,21 @@ const own = {}.hasOwnProperty
1212
test('sanitize()', (t) => {
1313
t.test('non-node', (t) => {
1414
// @ts-expect-error runtime.
15-
t.equal(html(sanitize(true)), '', 'should ignore non-nodes (#1)')
15+
t.equal(toHtml(sanitize(true)), '', 'should ignore non-nodes (#1)')
1616
// @ts-expect-error runtime.
17-
t.equal(html(sanitize(null)), '', 'should ignore non-nodes (#2)')
17+
t.equal(toHtml(sanitize(null)), '', 'should ignore non-nodes (#2)')
1818
// @ts-expect-error runtime.
19-
t.equal(html(sanitize(1)), '', 'should ignore non-nodes (#3)')
19+
t.equal(toHtml(sanitize(1)), '', 'should ignore non-nodes (#3)')
2020
// @ts-expect-error runtime.
21-
t.equal(html(sanitize([])), '', 'should ignore non-nodes (#4)')
21+
t.equal(toHtml(sanitize([])), '', 'should ignore non-nodes (#4)')
2222

2323
t.end()
2424
})
2525

2626
t.test('unknown nodes', (t) => {
2727
t.equal(
2828
// @ts-expect-error runtime.
29-
html(sanitize(u('unknown', '<xml></xml>'))),
29+
toHtml(sanitize(u('unknown', '<xml></xml>'))),
3030
'',
3131
'should ignore unknown nodes'
3232
)
@@ -35,26 +35,30 @@ test('sanitize()', (t) => {
3535
})
3636

3737
t.test('ignored nodes', (t) => {
38-
// @ts-expect-error runtime.
39-
t.equal(html(sanitize(u('raw', '<xml></xml>'))), '', 'should ignore `raw`')
38+
t.equal(
39+
// @ts-expect-error runtime.
40+
toHtml(sanitize(u('raw', '<xml></xml>'))),
41+
'',
42+
'should ignore `raw`'
43+
)
4044

4145
t.equal(
4246
// @ts-expect-error runtime.
43-
html(sanitize(u('directive', {name: '!alpha'}, '!alpha bravo'))),
47+
toHtml(sanitize(u('directive', {name: '!alpha'}, '!alpha bravo'))),
4448
'',
4549
'should ignore declaration `directive`s'
4650
)
4751

4852
t.equal(
4953
// @ts-expect-error runtime.
50-
html(sanitize(u('directive', {name: '?xml'}, '?xml version="1.0"'))),
54+
toHtml(sanitize(u('directive', {name: '?xml'}, '?xml version="1.0"'))),
5155
'',
5256
'should ignore processing instruction `directive`s'
5357
)
5458

5559
t.equal(
5660
// @ts-expect-error runtime.
57-
html(sanitize(u('characterData', 'alpha'))),
61+
toHtml(sanitize(u('characterData', 'alpha'))),
5862
'',
5963
'should ignore `characterData`s'
6064
)
@@ -64,26 +68,26 @@ test('sanitize()', (t) => {
6468

6569
t.test('`comment`', (t) => {
6670
t.equal(
67-
html(sanitize(u('comment', 'alpha'))),
71+
toHtml(sanitize(u('comment', 'alpha'))),
6872
'',
6973
'should ignore `comment`s by default'
7074
)
7175

7276
t.equal(
73-
html(sanitize(u('comment', 'alpha'), {allowComments: true})),
77+
toHtml(sanitize(u('comment', 'alpha'), {allowComments: true})),
7478
'<!--alpha-->',
7579
'should allow `comment`s with `allowComments: true`'
7680
)
7781

7882
t.equal(
7983
// @ts-expect-error runtime.
80-
html(sanitize(u('comment', {toString}), {allowComments: true})),
84+
toHtml(sanitize(u('comment', {toString}), {allowComments: true})),
8185
'<!---->',
8286
'should ignore non-string `value`s with `allowComments: true`'
8387
)
8488

8589
t.equal(
86-
html(
90+
toHtml(
8791
sanitize(u('comment', 'alpha--><script>alert(1)</script><!--bravo'), {
8892
allowComments: true
8993
})
@@ -97,13 +101,13 @@ test('sanitize()', (t) => {
97101

98102
t.test('`doctype`', (t) => {
99103
t.equal(
100-
html(sanitize(u('doctype', {name: 'html'}, 'alpha'))),
104+
toHtml(sanitize(u('doctype', {name: 'html'}, 'alpha'))),
101105
'',
102106
'should ignore `doctype`s by default'
103107
)
104108

105109
t.equal(
106-
html(
110+
toHtml(
107111
sanitize(u('doctype', {name: 'html'}, 'alpha'), {allowDoctypes: true})
108112
),
109113
'<!doctype html>',
@@ -142,26 +146,26 @@ test('sanitize()', (t) => {
142146
)
143147

144148
t.equal(
145-
html(sanitize(u('text', 'alert(1)'))),
149+
toHtml(sanitize(u('text', 'alert(1)'))),
146150
'alert(1)',
147151
'should allow `text`'
148152
)
149153

150154
t.equal(
151155
// @ts-expect-error runtime.
152-
html(sanitize(u('text', {toString}))),
156+
toHtml(sanitize(u('text', {toString}))),
153157
'',
154158
'should ignore non-string `value`s'
155159
)
156160

157161
t.equal(
158-
html(sanitize(h('script', u('text', 'alert(1)')))),
162+
toHtml(sanitize(h('script', u('text', 'alert(1)')))),
159163
'',
160164
'should ignore `text` in `script` elements'
161165
)
162166

163167
t.equal(
164-
html(sanitize(h('style', u('text', 'alert(1)')))),
168+
toHtml(sanitize(h('style', u('text', 'alert(1)')))),
165169
'alert(1)',
166170
'should show `text` in `style` elements'
167171
)

0 commit comments

Comments
 (0)