diff --git a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js index 45fec880410..4b769aaebf9 100644 --- a/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMSuspensePlaceholder-test.js @@ -90,9 +90,9 @@ describe('ReactDOMSuspensePlaceholder', () => { ); } ReactDOM.render(, container); - expect(divs[0].current.style.display).toEqual('none'); - expect(divs[1].current.style.display).toEqual('none'); - expect(divs[2].current.style.display).toEqual('none'); + expect(divs[0].current.style.display).toEqual('none !important'); + expect(divs[1].current.style.display).toEqual('none !important'); + expect(divs[2].current.style.display).toEqual('none !important'); await advanceTimers(500); @@ -156,12 +156,14 @@ describe('ReactDOMSuspensePlaceholder', () => { ReactDOM.render(, container); }); expect(container.innerHTML).toEqual( - 'SiblingLoading...', + 'SiblingLoading...', ); act(() => setIsVisible(true)); expect(container.innerHTML).toEqual( - 'SiblingLoading...', + 'SiblingLoading...', ); await advanceTimers(500); diff --git a/packages/react-dom/src/client/ReactDOMHostConfig.js b/packages/react-dom/src/client/ReactDOMHostConfig.js index cdea9f903ba..a78ea672490 100644 --- a/packages/react-dom/src/client/ReactDOMHostConfig.js +++ b/packages/react-dom/src/client/ReactDOMHostConfig.js @@ -589,7 +589,7 @@ export function hideInstance(instance: Instance): void { // TODO: Does this work for all element types? What about MathML? Should we // pass host context to this method? instance = ((instance: any): HTMLElement); - instance.style.display = 'none'; + instance.style.display = 'none !important'; } export function hideTextInstance(textInstance: TextInstance): void { diff --git a/packages/react-fresh/src/__tests__/ReactFresh-test.js b/packages/react-fresh/src/__tests__/ReactFresh-test.js index 0cc1a6a5448..b46f1a125c5 100644 --- a/packages/react-fresh/src/__tests__/ReactFresh-test.js +++ b/packages/react-fresh/src/__tests__/ReactFresh-test.js @@ -1357,7 +1357,7 @@ describe('ReactFresh', () => { const fallbackChild = container.childNodes[1]; expect(primaryChild.textContent).toBe('Content 1'); expect(primaryChild.style.color).toBe('green'); - expect(primaryChild.style.display).toBe('none'); + expect(primaryChild.style.display).toBe('none !important'); expect(fallbackChild.textContent).toBe('Fallback 0'); expect(fallbackChild.style.color).toBe('green'); expect(fallbackChild.style.display).toBe(''); @@ -1371,7 +1371,7 @@ describe('ReactFresh', () => { expect(container.childNodes[1]).toBe(fallbackChild); expect(primaryChild.textContent).toBe('Content 1'); expect(primaryChild.style.color).toBe('green'); - expect(primaryChild.style.display).toBe('none'); + expect(primaryChild.style.display).toBe('none !important'); expect(fallbackChild.textContent).toBe('Fallback 1'); expect(fallbackChild.style.color).toBe('green'); expect(fallbackChild.style.display).toBe(''); @@ -1395,7 +1395,7 @@ describe('ReactFresh', () => { expect(container.childNodes[1]).toBe(fallbackChild); expect(primaryChild.textContent).toBe('Content 1'); expect(primaryChild.style.color).toBe('red'); - expect(primaryChild.style.display).toBe('none'); + expect(primaryChild.style.display).toBe('none !important'); expect(fallbackChild.textContent).toBe('Fallback 1'); expect(fallbackChild.style.color).toBe('red'); expect(fallbackChild.style.display).toBe('');