Skip to content

Commit

Permalink
Unify Fire test cases with normal ones
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Sep 12, 2018
1 parent 7bc5f44 commit fa10f5f
Show file tree
Hide file tree
Showing 7 changed files with 228 additions and 1,259 deletions.
21 changes: 18 additions & 3 deletions packages/react-dom/src/__tests__/DOMPropertyOperations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

'use strict';

// Set by `yarn test-fire`.
const {disableInputAttributeSyncing} = require('shared/ReactFeatureFlags');

describe('DOMPropertyOperations', () => {
let React;
let ReactDOM;
Expand Down Expand Up @@ -80,7 +83,11 @@ describe('DOMPropertyOperations', () => {
it('should not remove empty attributes for special input properties', () => {
const container = document.createElement('div');
ReactDOM.render(<input value="" onChange={() => {}} />, container);
expect(container.firstChild.getAttribute('value')).toBe('');
if (disableInputAttributeSyncing) {
expect(container.firstChild.hasAttribute('value')).toBe(false);
} else {
expect(container.firstChild.getAttribute('value')).toBe('');
}
expect(container.firstChild.value).toBe('');
});

Expand Down Expand Up @@ -165,7 +172,11 @@ describe('DOMPropertyOperations', () => {
<input type="text" value="foo" onChange={function() {}} />,
container,
);
expect(container.firstChild.getAttribute('value')).toBe('foo');
if (disableInputAttributeSyncing) {
expect(container.firstChild.hasAttribute('value')).toBe(false);
} else {
expect(container.firstChild.getAttribute('value')).toBe('foo');
}
expect(container.firstChild.value).toBe('foo');
expect(() =>
ReactDOM.render(
Expand All @@ -175,7 +186,11 @@ describe('DOMPropertyOperations', () => {
).toWarnDev(
'A component is changing a controlled input of type text to be uncontrolled',
);
expect(container.firstChild.getAttribute('value')).toBe('foo');
if (disableInputAttributeSyncing) {
expect(container.firstChild.hasAttribute('value')).toBe(false);
} else {
expect(container.firstChild.getAttribute('value')).toBe('foo');
}
expect(container.firstChild.value).toBe('foo');
});

Expand Down
Loading

0 comments on commit fa10f5f

Please sign in to comment.