@@ -29,8 +29,10 @@ test('sanitize()', async (t) => {
2929
3030 await t . test ( 'unknown nodes' , ( ) => {
3131 assert . equal (
32- // @ts -expect-error runtime.
33- toHtml ( sanitize ( u ( 'unknown' , '<xml></xml>' ) ) ) ,
32+ toHtml (
33+ // @ts -expect-error runtime.
34+ sanitize ( u ( 'unknown' , '<xml></xml>' ) )
35+ ) ,
3436 '' ,
3537 'should ignore unknown nodes'
3638 )
@@ -47,8 +49,10 @@ test('sanitize()', async (t) => {
4749 )
4850
4951 assert . equal (
50- // @ts -expect-error runtime.
51- toHtml ( sanitize ( u ( 'directive' , { name : '!alpha' } , '!alpha bravo' ) ) ) ,
52+ toHtml (
53+ // @ts -expect-error: no longer a hast node.
54+ sanitize ( u ( 'directive' , { name : '!alpha' } , '!alpha bravo' ) )
55+ ) ,
5256 '' ,
5357 'should ignore declaration `directive`s'
5458 )
@@ -70,12 +74,14 @@ test('sanitize()', async (t) => {
7074
7175 await t . test ( '`comment`' , ( ) => {
7276 assert . equal (
77+ // @ts -expect-error: remove when `hast-util-to-html` updates.
7378 toHtml ( sanitize ( u ( 'comment' , 'alpha' ) ) ) ,
7479 '' ,
7580 'should ignore `comment`s by default'
7681 )
7782
7883 assert . equal (
84+ // @ts -expect-error: remove when `hast-util-to-html` updates.
7985 toHtml ( sanitize ( u ( 'comment' , 'alpha' ) , { allowComments : true } ) ) ,
8086 '<!--alpha-->' ,
8187 'should allow `comment`s with `allowComments: true`'
@@ -90,6 +96,7 @@ test('sanitize()', async (t) => {
9096
9197 assert . equal (
9298 toHtml (
99+ // @ts -expect-error: remove when `hast-util-to-html` updates.
93100 sanitize ( u ( 'comment' , 'alpha--><script>alert(1)</script><!--bravo' ) , {
94101 allowComments : true
95102 } )
@@ -101,13 +108,15 @@ test('sanitize()', async (t) => {
101108
102109 await t . test ( '`doctype`' , ( ) => {
103110 assert . equal (
111+ // @ts -expect-error: remove when `hast-util-to-html` updates.
104112 toHtml ( sanitize ( u ( 'doctype' , { name : 'html' } , 'alpha' ) ) ) ,
105113 '' ,
106114 'should ignore `doctype`s by default'
107115 )
108116
109117 assert . equal (
110118 toHtml (
119+ // @ts -expect-error: remove when `hast-util-to-html` updates.
111120 sanitize ( u ( 'doctype' , { name : 'html' } , 'alpha' ) , { allowDoctypes : true } )
112121 ) ,
113122 '<!doctype html>' ,
@@ -144,6 +153,7 @@ test('sanitize()', async (t) => {
144153 )
145154
146155 assert . equal (
156+ // @ts -expect-error: remove when `hast-util-to-html` updates.
147157 toHtml ( sanitize ( u ( 'text' , 'alert(1)' ) ) ) ,
148158 'alert(1)' ,
149159 'should allow `text`'
@@ -157,12 +167,14 @@ test('sanitize()', async (t) => {
157167 )
158168
159169 assert . equal (
170+ // @ts -expect-error: remove when `hast-util-to-html` updates.
160171 toHtml ( sanitize ( h ( 'script' , u ( 'text' , 'alert(1)' ) ) ) ) ,
161172 '' ,
162173 'should ignore `text` in `script` elements'
163174 )
164175
165176 assert . equal (
177+ // @ts -expect-error: remove when `hast-util-to-html` updates.
166178 toHtml ( sanitize ( h ( 'style' , u ( 'text' , 'alert(1)' ) ) ) ) ,
167179 'alert(1)' ,
168180 'should show `text` in `style` elements'
0 commit comments