Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump RN to 0.62 #273

Merged
merged 2 commits into from
Apr 20, 2020
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ node_modules/warning/.*
[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/interface.js
node_modules/react-native/flow/
flow-typed

Expand All @@ -38,9 +38,8 @@ module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"@babel/core": "^7.8.7",
"@callstack/eslint-config": "^9.1.0",
"@release-it/conventional-changelog": "^1.1.0",
"@types/react": "^16.9.23",
"@types/react-native": "^0.61.23",
"@types/react": "^16.9.34",
"@types/react-native": "^0.62.2",
"@types/react-test-renderer": "^16.9.2",
"babel-jest": "^25.1.0",
"conventional-changelog-cli": "^2.0.11",
"dedent": "^0.7.0",
"eslint": "^6.8.0",
"flow-bin": "^0.107.0",
"flow-bin": "^0.116.0",
"flow-copy-source": "^2.0.6",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"react": "^16.13.0",
"react-native": "^0.61.5",
"react-native": "^0.62.2",
"react-test-renderer": "^16.13.0",
"release-it": "^12.3.3",
"strip-ansi": "^5.2.0",
Expand Down
35 changes: 16 additions & 19 deletions src/__tests__/__snapshots__/debug.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`debug 1`] = `
"<TouchableOpacity
activeOpacity={0.2}
"<ForwardRef
onPress={[Function _callee]}
>
<TextComponent
text=\\"Press me 0\\"
/>
</TouchableOpacity>"
</ForwardRef>"
`;

exports[`debug.deep 1`] = `
"<View
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
onClick={[Function onClick]}
onResponderGrant={[Function onResponderGrant]}
onResponderMove={[Function onResponderMove]}
onResponderRelease={[Function onResponderRelease]}
onResponderTerminate={[Function onResponderTerminate]}
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
style={
Object {
\\"opacity\\": 1,
Expand All @@ -39,14 +37,13 @@ exports[`debug.deep async test 1`] = `
"<View
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
onClick={[Function onClick]}
onResponderGrant={[Function onResponderGrant]}
onResponderMove={[Function onResponderMove]}
onResponderRelease={[Function onResponderRelease]}
onResponderTerminate={[Function onResponderTerminate]}
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
style={
Object {
\\"opacity\\": 1,
Expand Down
54 changes: 25 additions & 29 deletions src/__tests__/__snapshots__/render.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ exports[`debug 1`] = `
<View
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
onClick={[Function onClick]}
onResponderGrant={[Function onResponderGrant]}
onResponderMove={[Function onResponderMove]}
onResponderRelease={[Function onResponderRelease]}
onResponderTerminate={[Function onResponderTerminate]}
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
style={
Object {
\\"opacity\\": 1,
Expand Down Expand Up @@ -92,14 +91,13 @@ exports[`debug changing component: bananaFresh button message should now be "fre
<View
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
onClick={[Function onClick]}
onResponderGrant={[Function onResponderGrant]}
onResponderMove={[Function onResponderMove]}
onResponderRelease={[Function onResponderRelease]}
onResponderTerminate={[Function onResponderTerminate]}
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
style={
Object {
\\"opacity\\": 1,
Expand Down Expand Up @@ -136,15 +134,15 @@ exports[`debug: shallow 1`] = `
>
not fresh
</Text>
<TextInput
<Component
allowFontScaling={true}
placeholder=\\"Add custom freshness\\"
rejectResponderTermination={true}
testID=\\"bananaCustomFreshness\\"
underlineColorAndroid=\\"transparent\\"
value=\\"Custom Freshie\\"
/>
<TextInput
<Component
allowFontScaling={true}
placeholder=\\"Who inspected freshness?\\"
rejectResponderTermination={true}
Expand Down Expand Up @@ -186,15 +184,15 @@ exports[`debug: shallow with message 1`] = `
>
not fresh
</Text>
<TextInput
<Component
allowFontScaling={true}
placeholder=\\"Add custom freshness\\"
rejectResponderTermination={true}
testID=\\"bananaCustomFreshness\\"
underlineColorAndroid=\\"transparent\\"
value=\\"Custom Freshie\\"
/>
<TextInput
<Component
allowFontScaling={true}
placeholder=\\"Who inspected freshness?\\"
rejectResponderTermination={true}
Expand Down Expand Up @@ -255,14 +253,13 @@ exports[`debug: with message 1`] = `
<View
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function bound touchableHandlePress]}
onResponderGrant={[Function bound touchableHandleResponderGrant]}
onResponderMove={[Function bound touchableHandleResponderMove]}
onResponderRelease={[Function bound touchableHandleResponderRelease]}
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
onClick={[Function onClick]}
onResponderGrant={[Function onResponderGrant]}
onResponderMove={[Function onResponderMove]}
onResponderRelease={[Function onResponderRelease]}
onResponderTerminate={[Function onResponderTerminate]}
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
style={
Object {
\\"opacity\\": 1,
Expand Down Expand Up @@ -293,7 +290,6 @@ exports[`toJSON 1`] = `
<View
accessible={true}
focusable={false}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
Expand Down
8 changes: 6 additions & 2 deletions src/__tests__/a11yAPI.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const Typography = ({ children, ...rest }: any) => {
class Button extends React.Component<any> {
render() {
return (
// $FlowFixMe - accessibilityStates removed in RN 0.62
<TouchableOpacity
accessibilityHint={BUTTON_HINT}
accessibilityLabel={BUTTON_LABEL}
Expand Down Expand Up @@ -49,6 +50,7 @@ function Section() {
accessibilityHint={TEXT_HINT}
accessibilityLabel={TEXT_LABEL}
accessibilityRole={TEXT_ROLE}
// $FlowFixMe - removed in RN 0.62
accessibilityStates={['selected', 'disabled']}
accessibilityState={{ expanded: false }}
accessibilityValue={{ max: 60 }}
Expand Down Expand Up @@ -130,7 +132,8 @@ test('getAllByA11yRole, queryAllByA11yRole', () => {
expect(queryAllByA11yRole(NO_MATCHES_TEXT)).toEqual([]);
});

test('getByA11yStates, queryByA11yStates', () => {
// TODO: accessibilityStates was removed from RN 0.62
test.skip('getByA11yStates, queryByA11yStates', () => {
const { getByA11yStates, queryByA11yStates } = render(<Section />);

expect(getByA11yStates('disabled').props.accessibilityStates).toEqual([
Expand All @@ -155,7 +158,8 @@ test('getByA11yStates, queryByA11yStates', () => {
expect(() => queryByA11yStates('selected')).toThrow(FOUND_TWO_INSTANCES);
});

test('getAllByA11yStates, queryAllByA11yStates', () => {
// TODO: accessibilityStates was removed from RN 0.62
test.skip('getAllByA11yStates, queryAllByA11yStates', () => {
const { getAllByA11yStates, queryAllByA11yStates } = render(<Section />);

expect(getAllByA11yStates('selected')).toHaveLength(3);
Expand Down
16 changes: 3 additions & 13 deletions src/__tests__/fireEvent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ describe('fireEvent', () => {
});

test('should throw an Error when event handler was not found', () => {
const { getByTestId } = render(<WithoutEventComponent />);
const { getByTestId } = render(
<WithoutEventComponent onPress={() => 'this is not passed to children'} />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on #28 I've added this instead of the should not bubble event to root element test that started to fail

);

expect(() => fireEvent(getByTestId('text'), 'press')).toThrow(
'No handler function found for event: "press"'
Expand All @@ -78,18 +80,6 @@ describe('fireEvent', () => {

expect(handlerMock).toHaveBeenCalledWith(EVENT_DATA);
});

test('should not bubble event to root element', () => {
const onPressMock = jest.fn();
const { getByTestId } = render(
<TouchableOpacity onPress={onPressMock}>
<Text testID="test">Content</Text>
</TouchableOpacity>
);

expect(() => fireEvent.press(getByTestId('test'))).toThrow();
expect(onPressMock).not.toHaveBeenCalled();
});
Comment on lines -82 to -92
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test seems fishy and not testing what it's supposed to. Not really sure why it didn't fail earlier, since the test testID is there, we can press it, and closest onPress is bound, so it should be called.

});

test('fireEvent.press', () => {
Expand Down
Loading