mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
chore: bump RN to 0.62 (#273)
* chore: bump RN to 0.62 * disable accessibilityStates tests; fixups
This commit is contained in:
committed by
GitHub
parent
0ecf788171
commit
d8fd1543e4
+2
-3
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+4
-4
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
@@ -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,
|
||||
@@ -136,7 +134,7 @@ exports[`debug: shallow 1`] = `
|
||||
>
|
||||
not fresh
|
||||
</Text>
|
||||
<TextInput
|
||||
<Component
|
||||
allowFontScaling={true}
|
||||
placeholder=\\"Add custom freshness\\"
|
||||
rejectResponderTermination={true}
|
||||
@@ -144,7 +142,7 @@ exports[`debug: shallow 1`] = `
|
||||
underlineColorAndroid=\\"transparent\\"
|
||||
value=\\"Custom Freshie\\"
|
||||
/>
|
||||
<TextInput
|
||||
<Component
|
||||
allowFontScaling={true}
|
||||
placeholder=\\"Who inspected freshness?\\"
|
||||
rejectResponderTermination={true}
|
||||
@@ -186,7 +184,7 @@ exports[`debug: shallow with message 1`] = `
|
||||
>
|
||||
not fresh
|
||||
</Text>
|
||||
<TextInput
|
||||
<Component
|
||||
allowFontScaling={true}
|
||||
placeholder=\\"Add custom freshness\\"
|
||||
rejectResponderTermination={true}
|
||||
@@ -194,7 +192,7 @@ exports[`debug: shallow with message 1`] = `
|
||||
underlineColorAndroid=\\"transparent\\"
|
||||
value=\\"Custom Freshie\\"
|
||||
/>
|
||||
<TextInput
|
||||
<Component
|
||||
allowFontScaling={true}
|
||||
placeholder=\\"Who inspected freshness?\\"
|
||||
rejectResponderTermination={true}
|
||||
@@ -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,
|
||||
@@ -293,7 +290,6 @@ exports[`toJSON 1`] = `
|
||||
<View
|
||||
accessible={true}
|
||||
focusable={false}
|
||||
isTVSelectable={true}
|
||||
onClick={[Function]}
|
||||
onResponderGrant={[Function]}
|
||||
onResponderMove={[Function]}
|
||||
|
||||
@@ -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}
|
||||
@@ -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 }}
|
||||
@@ -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([
|
||||
@@ -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);
|
||||
|
||||
@@ -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'} />
|
||||
);
|
||||
|
||||
expect(() => fireEvent(getByTestId('text'), 'press')).toThrow(
|
||||
'No handler function found for event: "press"'
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
test('fireEvent.press', () => {
|
||||
|
||||
Reference in New Issue
Block a user