diff --git a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js
index 864caa0f3358f..c19777e7e56a3 100644
--- a/packages/react-dom/src/__tests__/ReactDOMFiber-test.js
+++ b/packages/react-dom/src/__tests__/ReactDOMFiber-test.js
@@ -461,6 +461,40 @@ describe('ReactDOMFiber', () => {
expect(container.innerHTML).toBe('
');
});
+ it('should unmount empty portal component wherever it appears', () => {
+ const portalContainer = document.createElement('div');
+
+ class Wrapper extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ show: true,
+ };
+ }
+ render() {
+ return (
+
+ {this.state.show && (
+
+ {ReactDOM.createPortal(null, portalContainer)}
+ child
+
+ )}
+
parent
+
+ );
+ }
+ }
+
+ const instance = ReactDOM.render(, container);
+ expect(container.innerHTML).toBe(
+ '',
+ );
+ instance.setState({show: false});
+ expect(instance.state.show).toBe(false);
+ expect(container.innerHTML).toBe('');
+ });
+
it('should keep track of namespace across portals (simple)', () => {
assertNamespacesMatch(