-
Notifications
You must be signed in to change notification settings - Fork 48.1k
/
Copy pathReactDOMserverIntegrationProgress-test.js
50 lines (42 loc) · 1.35 KB
/
ReactDOMserverIntegrationProgress-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
* @jest-environment ./scripts/jest/ReactDOMServerIntegrationEnvironment
*/
'use strict';
const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils');
let React;
let ReactDOMClient;
let ReactDOMServer;
let ReactTestUtils;
function initModules() {
// Reset warning cache.
jest.resetModules();
React = require('react');
ReactDOMClient = require('react-dom/client');
ReactDOMServer = require('react-dom/server');
ReactTestUtils = require('react-dom/test-utils');
// Make them available to the helpers.
return {
ReactDOMClient,
ReactDOMServer,
ReactTestUtils,
};
}
const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules);
describe('ReactDOMServerIntegrationProgress', () => {
beforeEach(() => {
resetModules();
});
itRenders('a progress in an indeterminate state', async render => {
// Regression test for https://github.com/facebook/react/issues/6119
const e = await render(<progress value={null} />);
expect(e.hasAttribute('value')).toBe(false);
const e2 = await render(<progress value={50} />);
expect(e2.getAttribute('value')).toBe('50');
});
});