diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 3c8ce165ebb9..fce54e9dad5e 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -441,110 +441,108 @@ describe('ReactDOMComponent', () => { expect(node.hasAttribute('data-foo')).toBe(false); }); - if (ReactFeatureFlags.enableFilterEmptyStringAttributesDOM) { - it('should not add an empty src attribute', () => { - const container = document.createElement('div'); - expect(() => ReactDOM.render(, container)).toErrorDev( - 'An empty string ("") was passed to the src attribute. ' + - 'This may cause the browser to download the whole page again over the network. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to src instead of an empty string.', - ); - const node = container.firstChild; - expect(node.hasAttribute('src')).toBe(false); + it('should not add an empty src attribute', () => { + const container = document.createElement('div'); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the src attribute. ' + + 'This may cause the browser to download the whole page again over the network. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to src instead of an empty string.', + ); + const node = container.firstChild; + expect(node.hasAttribute('src')).toBe(false); - ReactDOM.render(, container); - expect(node.hasAttribute('src')).toBe(true); + ReactDOM.render(, container); + expect(node.hasAttribute('src')).toBe(true); - expect(() => ReactDOM.render(, container)).toErrorDev( - 'An empty string ("") was passed to the src attribute. ' + - 'This may cause the browser to download the whole page again over the network. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to src instead of an empty string.', - ); - expect(node.hasAttribute('src')).toBe(false); - }); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the src attribute. ' + + 'This may cause the browser to download the whole page again over the network. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to src instead of an empty string.', + ); + expect(node.hasAttribute('src')).toBe(false); + }); - it('should not add an empty href attribute', () => { - const container = document.createElement('div'); - expect(() => ReactDOM.render(, container)).toErrorDev( - 'An empty string ("") was passed to the href attribute. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to href instead of an empty string.', - ); - const node = container.firstChild; - expect(node.hasAttribute('href')).toBe(false); + it('should not add an empty href attribute', () => { + const container = document.createElement('div'); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the href attribute. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to href instead of an empty string.', + ); + const node = container.firstChild; + expect(node.hasAttribute('href')).toBe(false); - ReactDOM.render(, container); - expect(node.hasAttribute('href')).toBe(true); + ReactDOM.render(, container); + expect(node.hasAttribute('href')).toBe(true); - expect(() => ReactDOM.render(, container)).toErrorDev( - 'An empty string ("") was passed to the href attribute. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to href instead of an empty string.', - ); - expect(node.hasAttribute('href')).toBe(false); - }); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the href attribute. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to href instead of an empty string.', + ); + expect(node.hasAttribute('href')).toBe(false); + }); - it('should not add an empty action attribute', () => { - const container = document.createElement('div'); - expect(() => ReactDOM.render(
, container)).toErrorDev( - 'An empty string ("") was passed to the action attribute. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to action instead of an empty string.', - ); - const node = container.firstChild; - expect(node.hasAttribute('action')).toBe(false); + it('should not add an empty action attribute', () => { + const container = document.createElement('div'); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the action attribute. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to action instead of an empty string.', + ); + const node = container.firstChild; + expect(node.hasAttribute('action')).toBe(false); - ReactDOM.render(, container); - expect(node.hasAttribute('action')).toBe(true); + ReactDOM.render(, container); + expect(node.hasAttribute('action')).toBe(true); - expect(() => ReactDOM.render(, container)).toErrorDev( - 'An empty string ("") was passed to the action attribute. ' + - 'To fix this, either do not render the element at all ' + - 'or pass null to action instead of an empty string.', - ); - expect(node.hasAttribute('action')).toBe(false); - }); + expect(() => ReactDOM.render(, container)).toErrorDev( + 'An empty string ("") was passed to the action attribute. ' + + 'To fix this, either do not render the element at all ' + + 'or pass null to action instead of an empty string.', + ); + expect(node.hasAttribute('action')).toBe(false); + }); - it('should not add an empty formAction attribute', () => { - const container = document.createElement('div'); - expect(() => - ReactDOM.render(