Skip to content

Commit fa10f5f

Browse files
committed
Unify Fire test cases with normal ones
1 parent 7bc5f44 commit fa10f5f

File tree

7 files changed

+228
-1259
lines changed

7 files changed

+228
-1259
lines changed

packages/react-dom/src/__tests__/DOMPropertyOperations-test.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
'use strict';
1111

12+
// Set by `yarn test-fire`.
13+
const {disableInputAttributeSyncing} = require('shared/ReactFeatureFlags');
14+
1215
describe('DOMPropertyOperations', () => {
1316
let React;
1417
let ReactDOM;
@@ -80,7 +83,11 @@ describe('DOMPropertyOperations', () => {
8083
it('should not remove empty attributes for special input properties', () => {
8184
const container = document.createElement('div');
8285
ReactDOM.render(<input value="" onChange={() => {}} />, container);
83-
expect(container.firstChild.getAttribute('value')).toBe('');
86+
if (disableInputAttributeSyncing) {
87+
expect(container.firstChild.hasAttribute('value')).toBe(false);
88+
} else {
89+
expect(container.firstChild.getAttribute('value')).toBe('');
90+
}
8491
expect(container.firstChild.value).toBe('');
8592
});
8693

@@ -165,7 +172,11 @@ describe('DOMPropertyOperations', () => {
165172
<input type="text" value="foo" onChange={function() {}} />,
166173
container,
167174
);
168-
expect(container.firstChild.getAttribute('value')).toBe('foo');
175+
if (disableInputAttributeSyncing) {
176+
expect(container.firstChild.hasAttribute('value')).toBe(false);
177+
} else {
178+
expect(container.firstChild.getAttribute('value')).toBe('foo');
179+
}
169180
expect(container.firstChild.value).toBe('foo');
170181
expect(() =>
171182
ReactDOM.render(
@@ -175,7 +186,11 @@ describe('DOMPropertyOperations', () => {
175186
).toWarnDev(
176187
'A component is changing a controlled input of type text to be uncontrolled',
177188
);
178-
expect(container.firstChild.getAttribute('value')).toBe('foo');
189+
if (disableInputAttributeSyncing) {
190+
expect(container.firstChild.hasAttribute('value')).toBe(false);
191+
} else {
192+
expect(container.firstChild.getAttribute('value')).toBe('foo');
193+
}
179194
expect(container.firstChild.value).toBe('foo');
180195
});
181196

0 commit comments

Comments
 (0)