Skip to content

Commit 75e77f0

Browse files
committed
Added a small test for working of Simulate with renderIntoDocument
1 parent 168da8d commit 75e77f0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/react-dom/src/__tests__/ReactTestUtils-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,4 +503,19 @@ describe('ReactTestUtils', () => {
503503
ReactTestUtils.renderIntoDocument(<Component />);
504504
expect(mockArgs.length).toEqual(0);
505505
});
506+
it('should find rendered component with type in document', () => {
507+
class MyComponent extends React.Component {
508+
render() {
509+
return true;
510+
}
511+
}
512+
513+
const instance = ReactTestUtils.renderIntoDocument(<MyComponent />);
514+
const renderedComponentType = ReactTestUtils.findRenderedComponentWithType(
515+
instance,
516+
MyComponent,
517+
);
518+
519+
expect(renderedComponentType).toBe(instance);
520+
});
506521
});

0 commit comments

Comments
 (0)