Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/enzyme-test-suite/test/ReactWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,34 @@ describeWithDOM('mount', () => {
});
});

describeIf(REACT16, 'forwardRef component', () => {
it('should find the forwardRef component', () => {
const FancyButton = React.forwardRef((props, forwardedRef) => (
<button ref={forwardedRef} />
));

class App extends React.Component {
constructor() {
super();
this.buttonRef = null;
}

render() {
return (
<FancyButton
ref={(buttonRef) => {
this.buttonRef = buttonRef;
}}
/>
);
}
}

const wrapper = mount(<App />);
expect(wrapper.find(FancyButton).length).toBe(1);
});
});

it('should find component based on a react prop', () => {
const wrapper = mount((
<div>
Expand Down