Skip to content

Commit

Permalink
Revert "Update Modal's mock to not render its children when it is not…
Browse files Browse the repository at this point in the history
… visible (facebook#32346)"

This reverts commit ec614c1.
  • Loading branch information
janicduplessis committed Oct 25, 2021
1 parent 51530d1 commit 07e65a1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 46 deletions.
9 changes: 0 additions & 9 deletions Libraries/Modal/__tests__/Modal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ describe('<Modal />', () => {
expect(instance).toMatchSnapshot();
});

it('should not render its children when mocked with visible=false', () => {
const instance = render.create(
<Modal visible={false}>
<View testID="child" />
</Modal>,
);
expect(instance.root.findAllByProps({testID: 'child'})).toHaveLength(0);
});

it('should shallow render as <Modal> when mocked', () => {
const output = render.shallow(
<Modal>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`<Modal /> should render as <RCTModalHostView> when not mocked 1`] = `
<RCTModalHostView
animationType="none"
hardwareAccelerated={false}
identifier={4}
identifier={1}
onDismiss={[Function]}
onStartShouldSetResponder={[Function]}
presentationStyle="fullScreen"
Expand Down
31 changes: 0 additions & 31 deletions jest/mockModal.js

This file was deleted.

8 changes: 3 additions & 5 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ jest
getNativeRef: jest.fn(),
}),
)
.mock('../Libraries/Modal/Modal', () => {
const baseComponent = mockComponent('../Libraries/Modal/Modal');
const mockModal = jest.requireActual('./mockModal');
return mockModal(baseComponent);
})
.mock('../Libraries/Modal/Modal', () =>
mockComponent('../Libraries/Modal/Modal'),
)
.mock('../Libraries/Components/View/View', () =>
mockComponent('../Libraries/Components/View/View', MockNativeMethods),
)
Expand Down

0 comments on commit 07e65a1

Please sign in to comment.