-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(appbar): do not pass any additional props to custom children comp…
…onents (#972)
- Loading branch information
Showing
3 changed files
with
261 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import Appbar from '../../Appbar/Appbar'; | ||
import Searchbar from '../../Searchbar'; | ||
|
||
describe('Appbar', () => { | ||
it('does not pass any additional props to Searchbar', () => { | ||
const tree = renderer | ||
.create( | ||
<Appbar> | ||
<Searchbar placeholder="Search" /> | ||
</Appbar> | ||
) | ||
.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
234 changes: 234 additions & 0 deletions
234
src/components/__tests__/Appbar/__snapshots__/Appbar.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,234 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Appbar does not pass any additional props to Searchbar 1`] = ` | ||
<View | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#6200ee", | ||
"elevation": 4, | ||
"flexDirection": "row", | ||
"height": 56, | ||
"paddingHorizontal": 4, | ||
"shadowColor": "#000000", | ||
"shadowOffset": Object { | ||
"height": 3, | ||
"width": 0, | ||
}, | ||
"shadowOpacity": 0.24, | ||
"shadowRadius": 4, | ||
} | ||
} | ||
> | ||
<View | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#ffffff", | ||
"borderRadius": 4, | ||
"elevation": 4, | ||
"flexDirection": "row", | ||
"shadowColor": "#000000", | ||
"shadowOffset": Object { | ||
"height": 3, | ||
"width": 0, | ||
}, | ||
"shadowOpacity": 0.24, | ||
"shadowRadius": 4, | ||
} | ||
} | ||
> | ||
<View | ||
accessibilityRole="button" | ||
accessible={true} | ||
hitSlop={ | ||
Object { | ||
"bottom": 6, | ||
"left": 6, | ||
"right": 6, | ||
"top": 6, | ||
} | ||
} | ||
isTVSelectable={true} | ||
onResponderGrant={[Function]} | ||
onResponderMove={[Function]} | ||
onResponderRelease={[Function]} | ||
onResponderTerminate={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
style={ | ||
Array [ | ||
Object { | ||
"overflow": "hidden", | ||
}, | ||
Array [ | ||
Object { | ||
"alignItems": "center", | ||
"borderRadius": 18, | ||
"height": 36, | ||
"justifyContent": "center", | ||
"margin": 6, | ||
"overflow": "visible", | ||
"width": 36, | ||
}, | ||
undefined, | ||
undefined, | ||
], | ||
] | ||
} | ||
> | ||
<View | ||
style={null} | ||
> | ||
<Text | ||
accessibilityElementsHidden={true} | ||
allowFontScaling={false} | ||
importantForAccessibility="no-hide-descendants" | ||
pointerEvents="none" | ||
style={ | ||
Array [ | ||
Object { | ||
"color": "rgba(0, 0, 0, 0.54)", | ||
"fontSize": 24, | ||
}, | ||
Array [ | ||
Object { | ||
"transform": Array [ | ||
Object { | ||
"scaleX": 1, | ||
}, | ||
], | ||
}, | ||
Object { | ||
"backgroundColor": "transparent", | ||
}, | ||
], | ||
Object { | ||
"fontFamily": "Material Icons", | ||
"fontStyle": "normal", | ||
"fontWeight": "normal", | ||
}, | ||
Object {}, | ||
] | ||
} | ||
> | ||
| ||
</Text> | ||
</View> | ||
</View> | ||
<TextInput | ||
accessibilityRole="search" | ||
accessibilityTraits="search" | ||
allowFontScaling={true} | ||
keyboardAppearance="light" | ||
placeholder="Search" | ||
placeholderTextColor="rgba(0, 0, 0, 0.54)" | ||
returnKeyType="search" | ||
selectionColor="#6200ee" | ||
style={ | ||
Array [ | ||
Object { | ||
"alignSelf": "stretch", | ||
"flex": 1, | ||
"fontSize": 18, | ||
"minWidth": 0, | ||
"paddingLeft": 8, | ||
"textAlign": "left", | ||
}, | ||
Object { | ||
"color": "#000000", | ||
"fontFamily": "Helvetica Neue", | ||
}, | ||
undefined, | ||
] | ||
} | ||
underlineColorAndroid="transparent" | ||
/> | ||
<View | ||
accessibilityRole="button" | ||
accessibilityStates={ | ||
Array [ | ||
"disabled", | ||
] | ||
} | ||
accessible={true} | ||
hitSlop={ | ||
Object { | ||
"bottom": 6, | ||
"left": 6, | ||
"right": 6, | ||
"top": 6, | ||
} | ||
} | ||
isTVSelectable={true} | ||
onResponderGrant={[Function]} | ||
onResponderMove={[Function]} | ||
onResponderRelease={[Function]} | ||
onResponderTerminate={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
style={ | ||
Array [ | ||
Object { | ||
"overflow": "hidden", | ||
}, | ||
Array [ | ||
Object { | ||
"alignItems": "center", | ||
"borderRadius": 18, | ||
"height": 36, | ||
"justifyContent": "center", | ||
"margin": 6, | ||
"overflow": "visible", | ||
"width": 36, | ||
}, | ||
Object { | ||
"opacity": 0.32, | ||
}, | ||
undefined, | ||
], | ||
] | ||
} | ||
> | ||
<View | ||
style={null} | ||
> | ||
<Text | ||
accessibilityElementsHidden={true} | ||
allowFontScaling={false} | ||
importantForAccessibility="no-hide-descendants" | ||
pointerEvents="none" | ||
style={ | ||
Array [ | ||
Object { | ||
"color": "rgba(255, 255, 255, 0)", | ||
"fontSize": 24, | ||
}, | ||
Array [ | ||
Object { | ||
"transform": Array [ | ||
Object { | ||
"scaleX": 1, | ||
}, | ||
], | ||
}, | ||
Object { | ||
"backgroundColor": "transparent", | ||
}, | ||
], | ||
Object { | ||
"fontFamily": "Material Icons", | ||
"fontStyle": "normal", | ||
"fontWeight": "normal", | ||
}, | ||
Object {}, | ||
] | ||
} | ||
> | ||
| ||
</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</View> | ||
`; |