mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Add E2E tests for Text boxShadow and textWithLinkRole (#55961)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55961 Add E2E tests for 2 uncovered Text examples in RNTester: - boxShadow: screenshot test using existing testID 'text-box-shadow' - textWithLinkRole: interaction test that screenshots before and after pressing the link (which changes its color from teal to red) Source changes: - Added testID="text-with-link-role" to root View in TextWithLinkRoleExample - Added testID="text-link-role-link" to the first link Text element - Added useState to toggle link color on press (teal -> red) Reviewed By: cortinico Differential Revision: D95359182 fbshipit-source-id: c823b1c0c071aed0750b3cf3f2d7d6b88da87573
This commit is contained in:
1 parent
66975aa3d5
commit
b172f46f0d
1 file changed
+9
-3
@@ -194,11 +194,17 @@ component RtlAndInlineViewsExample() {
|
||||
}
|
||||
|
||||
component TextWithLinkRoleExample() {
|
||||
const handlePress = () => console.log('Link Press');
|
||||
const [pressed, setPressed] = useState(false);
|
||||
const handlePress = () => setPressed(true);
|
||||
const linkColor = pressed ? 'red' : 'teal';
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Text role="link" style={styles.link} onPress={handlePress}>
|
||||
<View testID="text-with-link-role">
|
||||
<Text
|
||||
role="link"
|
||||
style={[styles.link, {color: linkColor}]}
|
||||
onPress={handlePress}
|
||||
testID="text-link-role-link">
|
||||
Link Text
|
||||
</Text>
|
||||
|
||||
|
||||
Reference in new issue
Block a user