Skip to content

Commit f943423

Browse files
committed
Add a more precise regression test for facebook#6219
1 parent 6ff062e commit f943423

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,25 @@ describe('DOMPropertyOperations', () => {
7777
expect(container.firstChild.getAttribute('class')).toBe('css-class');
7878
});
7979

80-
it('should not remove empty attributes for special properties', () => {
80+
it('should not remove empty attributes for special input properties', () => {
8181
const container = document.createElement('div');
8282
ReactDOM.render(<input value="" onChange={() => {}} />, container);
8383
expect(container.firstChild.getAttribute('value')).toBe('');
8484
expect(container.firstChild.value).toBe('');
8585
});
8686

87+
it('should not remove empty attributes for special option properties', () => {
88+
const container = document.createElement('div');
89+
ReactDOM.render(
90+
<select>
91+
<option value="">empty</option>
92+
</select>,
93+
container,
94+
);
95+
// Regression test for https://github.com/facebook/react/issues/6219
96+
expect(container.firstChild.firstChild.value).toBe('');
97+
});
98+
8799
it('should remove for falsey boolean properties', () => {
88100
const container = document.createElement('div');
89101
ReactDOM.render(<div allowFullScreen={false} />, container);

0 commit comments

Comments
 (0)