@@ -3587,6 +3587,9 @@ describe('ReactDOMFizzServer', () => {
3587
3587
'<script type="importmap">' +
3588
3588
JSON . stringify ( importMap ) +
3589
3589
'</script><script async="" src="foo"></script>' +
3590
+ ( gate ( flags => flags . shouldUseFizzExternalRuntime )
3591
+ ? '<script src="react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js" async=""></script>'
3592
+ : '' ) +
3590
3593
'<link rel="expect" href="#«R»" blocking="render">' ,
3591
3594
) ;
3592
3595
} ) ;
@@ -4501,7 +4504,8 @@ describe('ReactDOMFizzServer', () => {
4501
4504
expect ( document . getElementsByTagName ( 'script' ) . length ) . toEqual ( 1 ) ;
4502
4505
} ) ;
4503
4506
4504
- it ( 'does not send the external runtime for static pages' , async ( ) => {
4507
+ // @gate shouldUseFizzExternalRuntime
4508
+ it ( 'does (unfortunately) send the external runtime for static pages' , async ( ) => {
4505
4509
await act ( ( ) => {
4506
4510
const { pipe} = renderToPipeableStream (
4507
4511
< html >
@@ -4515,11 +4519,11 @@ describe('ReactDOMFizzServer', () => {
4515
4519
} ) ;
4516
4520
4517
4521
// no scripts should be sent
4518
- expect ( document . getElementsByTagName ( 'script' ) . length ) . toEqual ( 0 ) ;
4522
+ expect ( document . getElementsByTagName ( 'script' ) . length ) . toEqual ( 1 ) ;
4519
4523
4520
4524
// the html should be as-is
4521
4525
expect ( document . documentElement . innerHTML ) . toEqual (
4522
- '<head><link rel="expect" href="#«R»" blocking="render"></head><body><p>hello world!</p><template id="«R»"></template></body>' ,
4526
+ '<head><script src="react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js" async=""></script>< link rel="expect" href="#«R»" blocking="render"></head><body><p>hello world!</p><template id="«R»"></template></body>' ,
4523
4527
) ;
4524
4528
} ) ;
4525
4529
@@ -5317,7 +5321,9 @@ describe('ReactDOMFizzServer', () => {
5317
5321
} ) ;
5318
5322
5319
5323
expect ( container . innerHTML ) . toEqual (
5320
- '<div>hello<b>world, <!-- -->Foo</b>!</div>' ,
5324
+ ( gate ( flags => flags . shouldUseFizzExternalRuntime )
5325
+ ? '<script src="react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js" async=""></script>'
5326
+ : '' ) + '<div>hello<b>world, <!-- -->Foo</b>!</div>' ,
5321
5327
) ;
5322
5328
const errors = [ ] ;
5323
5329
ReactDOMClient . hydrateRoot ( container , < App name = "Foo" /> , {
@@ -5518,7 +5524,7 @@ describe('ReactDOMFizzServer', () => {
5518
5524
pipe ( writable ) ;
5519
5525
} ) ;
5520
5526
5521
- expect ( container . firstElementChild . outerHTML ) . toEqual (
5527
+ expect ( container . lastElementChild . outerHTML ) . toEqual (
5522
5528
'<div>hello<b>world<!-- --></b></div>' ,
5523
5529
) ;
5524
5530
@@ -5556,7 +5562,7 @@ describe('ReactDOMFizzServer', () => {
5556
5562
pipe ( writable ) ;
5557
5563
} ) ;
5558
5564
5559
- expect ( container . firstElementChild . outerHTML ) . toEqual (
5565
+ expect ( container . lastElementChild . outerHTML ) . toEqual (
5560
5566
'<div>hello<b>world</b></div>' ,
5561
5567
) ;
5562
5568
@@ -5696,7 +5702,10 @@ describe('ReactDOMFizzServer', () => {
5696
5702
} ) ;
5697
5703
5698
5704
expect ( container . innerHTML ) . toEqual (
5699
- '<div><!--$-->hello<!-- -->world<!-- --><!--/$--><!--$-->world<!-- --><!--/$--><!--$-->hello<!-- -->world<!-- --><br><!--/$--><!--$-->world<!-- --><br><!--/$--></div>' ,
5705
+ ( gate ( flags => flags . shouldUseFizzExternalRuntime )
5706
+ ? '<script src="react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js" async=""></script>'
5707
+ : '' ) +
5708
+ '<div><!--$-->hello<!-- -->world<!-- --><!--/$--><!--$-->world<!-- --><!--/$--><!--$-->hello<!-- -->world<!-- --><br><!--/$--><!--$-->world<!-- --><br><!--/$--></div>' ,
5700
5709
) ;
5701
5710
5702
5711
const errors = [ ] ;
@@ -6499,7 +6508,11 @@ describe('ReactDOMFizzServer', () => {
6499
6508
} ) ;
6500
6509
6501
6510
expect ( document . documentElement . outerHTML ) . toEqual (
6502
- '<html><head><link rel="expect" href="#«R»" blocking="render"></head><body><script>try { foo() } catch (e) {} ;</script><template id="«R»"></template></body></html>' ,
6511
+ '<html><head>' +
6512
+ ( gate ( flags => flags . shouldUseFizzExternalRuntime )
6513
+ ? '<script src="react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js" async=""></script>'
6514
+ : '' ) +
6515
+ '<link rel="expect" href="#«R»" blocking="render"></head><body><script>try { foo() } catch (e) {} ;</script><template id="«R»"></template></body></html>' ,
6503
6516
) ;
6504
6517
} ) ;
6505
6518
0 commit comments