Skip to content

Commit 0100b49

Browse files
Revert "Update Modal's mock to not render its children when it is not visible (facebook#32346)"
This reverts commit ec614c1.
1 parent 16888e3 commit 0100b49

File tree

4 files changed

+4
-46
lines changed

4 files changed

+4
-46
lines changed

Libraries/Modal/__tests__/Modal-test.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ describe('<Modal />', () => {
2727
expect(instance).toMatchSnapshot();
2828
});
2929

30-
it('should not render its children when mocked with visible=false', () => {
31-
const instance = render.create(
32-
<Modal visible={false}>
33-
<View testID="child" />
34-
</Modal>,
35-
);
36-
expect(instance.root.findAllByProps({testID: 'child'})).toHaveLength(0);
37-
});
38-
3930
it('should shallow render as <Modal> when mocked', () => {
4031
const output = render.shallow(
4132
<Modal>

Libraries/Modal/__tests__/__snapshots__/Modal-test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ exports[`<Modal /> should render as <RCTModalHostView> when not mocked 1`] = `
1313
<RCTModalHostView
1414
animationType="none"
1515
hardwareAccelerated={false}
16-
identifier={4}
16+
identifier={1}
1717
onDismiss={[Function]}
1818
onStartShouldSetResponder={[Function]}
1919
presentationStyle="fullScreen"

jest/mockModal.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

jest/setup.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ jest
110110
getNativeRef: jest.fn(),
111111
}),
112112
)
113-
.mock('../Libraries/Modal/Modal', () => {
114-
const baseComponent = mockComponent('../Libraries/Modal/Modal');
115-
const mockModal = jest.requireActual('./mockModal');
116-
return mockModal(baseComponent);
117-
})
113+
.mock('../Libraries/Modal/Modal', () =>
114+
mockComponent('../Libraries/Modal/Modal'),
115+
)
118116
.mock('../Libraries/Components/View/View', () =>
119117
mockComponent('../Libraries/Components/View/View', MockNativeMethods),
120118
)

0 commit comments

Comments
 (0)