| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @emails react-core |
| 8 | * @jest-environment ./scripts/jest/ReactDOMServerIntegrationEnvironment |
| 9 | */ |
| 10 | |
| 11 | 'use strict'; |
| 12 | |
| 13 | let React; |
| 14 | let ReactDOMFizzServer; |
| 15 | |
| 16 | describe('ReactDOMFloat', () => { |
| 17 | beforeEach(() => { |
| 18 | jest.resetModules(); |
| 19 | |
| 20 | React = require('react'); |
| 21 | ReactDOMFizzServer = require('react-dom/server'); |
| 22 | }); |
| 23 | |
| 24 | // fixes #27177 |
| 25 | it('does not hoist above the <html> tag', async () => { |
| 26 | const result = ReactDOMFizzServer.renderToString( |
| 27 | <html> |
| 28 | <head> |
| 29 | <script src="foo" /> |
| 30 | <meta charSet="utf-8" /> |
| 31 | <title>title</title> |
| 32 | </head> |
| 33 | </html>, |
| 34 | ); |
| 35 | |
| 36 | expect(result).toEqual( |
| 37 | '<html><head><meta charSet="utf-8"/>' + |
| 38 | '<title>title</title><script src="foo"></script></head>' + |
| 39 | '</html>', |
| 40 | ); |
| 41 | }); |
| 42 | }); |