-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Shallow does not find direct child when inside React.Fragment #1664
Copy link
Copy link
Closed
Description
Describe the bug
Shallow should find direct child when inside React.Fragment.
(At least it does so for indirect descendants).
To Reproduce
import * as React from 'react';
import {shallow} from 'enzyme';
const MyCom = () => (
<div className="container">
<React.Fragment>
<span>A span</span>
</React.Fragment>
</div>
);
describe('enzyme shallow', () => {
it('test#1: should find descendant span inside fragment ', () => {
const myCom = shallow(<MyCom />);
expect(myCom.find('.container span')).toHaveLength(1);
});
// TEST FAILS
it('test#2: should find direct child span inside fragment', () => {
const myCom = shallow(<MyCom />);
expect(myCom.find('.container > span')).toHaveLength(1);
});
});Expected behavior
Expect test#2 to pass.
Desktop (please complete the following information):
- OS: Ubuntu 16.04 LTS GNOME
- Browser: X
- Version: X
Additional context
Tests are failing inside Jest.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels