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

Tests: toTree on a rendered array #10616

Closed
porfirioribeiro opened this issue Sep 6, 2017 · 0 comments
Closed

Tests: toTree on a rendered array #10616

porfirioribeiro opened this issue Sep 6, 2017 · 0 comments
Assignees

Comments

@porfirioribeiro
Copy link

I don't know if this is a bug or if i am doing it wrong,
When i have a component that the render returns an array in Fiber, the rendered returns only the first element

const Wrap = ({ children }) => children;

describe('Test', () => {

    it('renders 2 div', () => {
        const rendered = ReactTestRenderer.create(
            <Wrap>
                <div>One</div>
                <div>Two</div>
            </Wrap>
        );
        console.log(rendered.toTree().rendered);
    })
})

What is the current behavior?
Log's only the first element

What is the expected behavior?
I think this should be an array of elements

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16

clemmy pushed a commit to clemmy/react that referenced this issue Sep 8, 2017
clemmy pushed a commit to clemmy/react that referenced this issue Sep 8, 2017
clemmy pushed a commit to clemmy/react that referenced this issue Sep 8, 2017
gaearon pushed a commit that referenced this issue Sep 14, 2017
* Fix bug with toTree on rendered array #10616

* Preserve previous behaviour of rendered being a node unless it's for rendering an array
@gaearon gaearon closed this as completed Oct 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants