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

Adjacent sibling selector issue #694

Closed
roastedfrost-zz opened this issue Nov 18, 2016 · 4 comments
Closed

Adjacent sibling selector issue #694

roastedfrost-zz opened this issue Nov 18, 2016 · 4 comments

Comments

@roastedfrost-zz
Copy link

Hi,
here is a problem

it('Adjacent sibling selector', () => {
    function Test() {
        return (
            <div>
                <div className="row">row1</div>
                <div className="row">row2</div>
                <div className="row">activeRow</div>
            </div>
        );    
    }
        
    const wrapper = mount(<Test />);
    expect(wrapper.find('.row + .row').length).to.be.eql(2); // ok
    expect(wrapper.find('.row + .row').at(0).text()).to.be.eql('row2'); // ok
    expect(wrapper.find('.row + .row').at(1).text()).to.be.eql('activeRow'); // ok
    expect(wrapper.find('.row + .row + .row').length).to.be.eql(1); // fails, expectation - 1, actual value - 0
});

React v15.3.2
Enzyme v2.6.0

@ljharb
Copy link
Member

ljharb commented Nov 18, 2016

Does the same thing happen on shallow?

@ljharb
Copy link
Member

ljharb commented Nov 18, 2016

This looks related to #689 which #691 fixes. I'll add your test case to that PR.

@ljharb
Copy link
Member

ljharb commented Nov 19, 2016

After giving this a shot, it's pretty complex to fix, so I won't do it as part of #691.

@ljharb ljharb reopened this Nov 19, 2016
@lglasgow
Copy link

Any workaround for this? I just ran into this problem today.

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

3 participants