@@ -620,15 +620,15 @@ describe('ReactDOMFizzServer', () => {
620620 }
621621 } ) ;
622622
623- it ( 'should render scripts with nonce added ' , async ( ) => {
623+ it ( 'should not automatically add nonce to rendered scripts ' , async ( ) => {
624624 CSPnonce = 'R4nd0m' ;
625625 try {
626626 await act ( async ( ) => {
627627 const { pipe} = renderToPipeableStream (
628628 < html >
629629 < body >
630- < script > { 'try { foo() } catch (e) {} ;' } </ script >
631- < script src = "foo" async = { true } />
630+ < script nonce = { CSPnonce } > { 'try { foo() } catch (e) {} ;' } </ script >
631+ < script nonce = { CSPnonce } src = "foo" async = { true } />
632632 < script src = "bar" />
633633 < script src = "baz" integrity = "qux" async = { true } />
634634 < script type = "module" src = "quux" async = { true } />
@@ -654,14 +654,13 @@ describe('ReactDOMFizzServer', () => {
654654 renderOptions . unstable_externalRuntimeSrc ,
655655 ) . map ( n => n . outerHTML ) ,
656656 ) . toEqual ( [
657- // async scripts get inserted first in render
658657 `<script nonce="${ CSPnonce } " src="foo" async=""></script>` ,
659- `<script nonce=" ${ CSPnonce } " src="baz" integrity="qux" async=""></script>` ,
660- `<script nonce=" ${ CSPnonce } " type="module" src="quux" async=""></script>` ,
661- `<script nonce=" ${ CSPnonce } " type="module" src="corge" async=""></script>` ,
662- `<script nonce=" ${ CSPnonce } " type="module" src="grault" integrity="garply" async=""></script>` ,
658+ `<script src="baz" integrity="qux" async=""></script>` ,
659+ `<script type="module" src="quux" async=""></script>` ,
660+ `<script type="module" src="corge" async=""></script>` ,
661+ `<script type="module" src="grault" integrity="garply" async=""></script>` ,
663662 `<script nonce="${ CSPnonce } ">try { foo() } catch (e) {} ;</script>` ,
664- `<script nonce=" ${ CSPnonce } " src="bar"></script>` ,
663+ `<script src="bar"></script>` ,
665664 ] ) ;
666665 } finally {
667666 CSPnonce = null ;
0 commit comments