@@ -37,4 +37,33 @@ export default function __AstroComponent_(_props: Record<string, any>): any {}\n
3737 assert . snapshot ( code , output , 'expected code to match snapshot' ) ;
3838} ) ;
3939
40+ test ( 'escape unknown types' , async ( ) => {
41+ const input = `<script type="text/somethigndf" is:inline>console.log("something");</script>` ;
42+ const output = `${ TSXPrefix } <Fragment>
43+ <script type="text/somethigndf" is:inline>{\`console.log("something");\`}</script>
44+ </Fragment>
45+ export default function __AstroComponent_(_props: Record<string, any>): any {}\n` ;
46+ const { code } = await convertToTSX ( input , { sourcemap : 'external' } ) ;
47+ assert . snapshot ( code , output , 'expected code to match snapshot' ) ;
48+ } ) ;
49+
50+ test ( "don't include scripts if disabled" , async ( ) => {
51+ const input = `
52+ <script>hello;</script>
53+ <script type="module">hello;</script>
54+ <script type="text/partytown">hello;</script>
55+ <script type="application/ld+json">hello;</script>
56+ <script type="text/somethigndf" is:inline>hello;</script>` ;
57+ const output = `${ TSXPrefix } <Fragment>
58+ <script></script>
59+ <script type="module"></script>
60+ <script type="text/partytown"></script>
61+ <script type="application/ld+json"></script>
62+ <script type="text/somethigndf" is:inline></script>
63+ </Fragment>
64+ export default function __AstroComponent_(_props: Record<string, any>): any {}\n` ;
65+ const { code } = await convertToTSX ( input , { sourcemap : 'external' , includeScripts : false } ) ;
66+ assert . snapshot ( code , output , 'expected code to match snapshot' ) ;
67+ } ) ;
68+
4069test . run ( ) ;
0 commit comments