@@ -267,6 +267,16 @@ describe('MDX basics (merged fixture)', () => {
267267 'style should not be html-escaped' ,
268268 ) ;
269269 } ) ;
270+
271+ it ( 'keeps set:text within script and style elements' , async ( ) => {
272+ const html = await fixture . readFile ( '/set-text/index.html' ) ;
273+ const { document } = parseHTML ( html ) ;
274+
275+ assert . match ( document . getElementById ( 'script-text' ) ! . textContent , / ^ & l t ; \/ s c r i p t & g t ; / ) ;
276+ assert . match ( document . getElementById ( 'style-text' ) ! . textContent , / ^ & l t ; \/ s t y l e & g t ; / ) ;
277+ assert . equal ( document . getElementById ( 'script-text-following' ) , null ) ;
278+ assert . equal ( document . getElementById ( 'style-text-following' ) , null ) ;
279+ } ) ;
270280 } ) ;
271281 } ) ;
272282
@@ -455,6 +465,19 @@ describe('MDX basics (merged fixture)', () => {
455465 'style should not be html-escaped' ,
456466 ) ;
457467 } ) ;
468+
469+ it ( 'keeps set:text within script and style elements' , async ( ) => {
470+ const res = await fixture . fetch ( '/set-text' ) ;
471+ assert . equal ( res . status , 200 ) ;
472+
473+ const html = await res . text ( ) ;
474+ const { document } = parseHTML ( html ) ;
475+
476+ assert . match ( document . getElementById ( 'script-text' ) ! . textContent , / ^ & l t ; \/ s c r i p t & g t ; / ) ;
477+ assert . match ( document . getElementById ( 'style-text' ) ! . textContent , / ^ & l t ; \/ s t y l e & g t ; / ) ;
478+ assert . equal ( document . getElementById ( 'script-text-following' ) , null ) ;
479+ assert . equal ( document . getElementById ( 'style-text-following' ) , null ) ;
480+ } ) ;
458481 } ) ;
459482 } ) ;
460483} ) ;
0 commit comments