Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter React 16 does not support new Portal node types #1164

Closed
flakeparadigm opened this issue Sep 27, 2017 · 1 comment
Closed

Adapter React 16 does not support new Portal node types #1164

flakeparadigm opened this issue Sep 27, 2017 · 1 comment

Comments

@flakeparadigm
Copy link

flakeparadigm commented Sep 27, 2017

Attempting to mount a component that renders a new Portal component type throws an error because then React 16 adapter does not know how to handle the node tag (4).

Thrown error: Error: Enzyme Internal Error: unknown node with tag 4

Enzyme method throwing the error: https://github.com/airbnb/enzyme/blob/master/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js#L59

The full list of React node "tags", of which there are many unimplemented in this method, can be found here: https://github.com/facebook/react/blob/master/src/shared/ReactTypeOfWork.js

Example code to reproduce this error:

class TestComponent extends React.Component {
    constructor(props) {
        super(props);
        this.el = document.createElement('div');
    }

    render() {
        return ReactDOM.createPortal(
            <div>Hello World</div>,
            this.el
        );
    }
}

enzyme.mount(<TestComponent />);
@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

Duplicate of #1150.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants