dillon1000/react
Commit
Browse files Simplify Jest-specific tests (#11243)
* Delete tests that only mattered during createElement transition They were added after #2576, but were only important when React.createElement was introduced as a migration path. Now that elements are used consistently, these tests shouldn't be necessary. I created a separate test specifically for scryRenderedComponentsWithType() though because that was the only one. * Simplify mocking test setup Today, the only remaining special behavior for Jest mocks is we let them render undefined. We don't plan to introduce any other special behavior for them in the future. (In fact, we already decided against replicating this special behavior for functional components.) Therefore, we can remove dependency on Jest automocking mechanism in these tests completely, and just explicitly mock the render method which is the only one for which we have special behavior. For clarity, we add an explicit test for mockComponent() API (whose naming is a bit of a lie).
Changed paths6 files
First-parent comparisonmocks/ReactElementTestChild.js DeletedD mocks/ReactMockedComponentTestComponent.js DeletedM package.json ModifiedM src/isomorphic/classic/element/__tests__/ReactElement-test.js ModifiedM src/renderers/__tests__/ReactMockedComponent-test.js ModifiedM src/renderers/dom/test/__tests__/ReactTestUtils-test.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…