| 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 | const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils'); |
| 14 | |
| 15 | let React; |
| 16 | let ReactDOMClient; |
| 17 | let ReactDOMServer; |
| 18 | |
| 19 | function initModules() { |
| 20 | // Reset warning cache. |
| 21 | jest.resetModules(); |
| 22 | React = require('react'); |
| 23 | ReactDOMClient = require('react-dom/client'); |
| 24 | ReactDOMServer = require('react-dom/server'); |
| 25 | |
| 26 | // Make them available to the helpers. |
| 27 | return { |
| 28 | ReactDOMClient, |
| 29 | ReactDOMServer, |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules); |
| 34 | |
| 35 | describe('ReactDOMServerIntegrationProgress', () => { |
| 36 | beforeEach(() => { |
| 37 | resetModules(); |
| 38 | }); |
| 39 | |
| 40 | itRenders('a progress in an indeterminate state', async render => { |
| 41 | // Regression test for https://github.com/facebook/react/issues/6119 |
| 42 | const e = await render(<progress value={null} />); |
| 43 | expect(e.hasAttribute('value')).toBe(false); |
| 44 | const e2 = await render(<progress value={50} />); |
| 45 | expect(e2.getAttribute('value')).toBe('50'); |
| 46 | }); |
| 47 | }); |