@samitouri / QOS-React / commits / f943423231

Add a more precise regression test for #6219

Dan Abramov committed Aug 31, 2018 at 15:54 UTC f943423231f7b82d3502d237580786a57324bead
1 file changed +13 -1
packages/react-dom/src/__tests__/DOMPropertyOperations-test.js
+13 -1
@@ -77,13 +77,25 @@ describe('DOMPropertyOperations', () => {
77 expect(container.firstChild.getAttribute('class')).toBe('css-class');
78 });
79
80 - it('should not remove empty attributes for special properties', () => {
80 + it('should not remove empty attributes for special input properties', () => {
81 const container = document.createElement('div');
82 ReactDOM.render(<input value="" onChange={() => {}} />, container);
83 expect(container.firstChild.getAttribute('value')).toBe('');
84 expect(container.firstChild.value).toBe('');
85 });
86
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 +
99 it('should remove for falsey boolean properties', () => {
100 const container = document.createElement('div');
101 ReactDOM.render(<div allowFullScreen={false} />, container);