Skip to content

Commit b172f46

Browse files
NickGerlemanmeta-codesync[bot]
authored andcommitted
Add E2E tests for Text boxShadow and textWithLinkRole (#55961)
Summary: Pull Request resolved: #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
1 parent 66975aa commit b172f46

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/rn-tester/js/examples/Text/TextSharedExamples.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,17 @@ component RtlAndInlineViewsExample() {
194194
}
195195

196196
component TextWithLinkRoleExample() {
197-
const handlePress = () => console.log('Link Press');
197+
const [pressed, setPressed] = useState(false);
198+
const handlePress = () => setPressed(true);
199+
const linkColor = pressed ? 'red' : 'teal';
198200

199201
return (
200-
<View>
201-
<Text role="link" style={styles.link} onPress={handlePress}>
202+
<View testID="text-with-link-role">
203+
<Text
204+
role="link"
205+
style={[styles.link, {color: linkColor}]}
206+
onPress={handlePress}
207+
testID="text-link-role-link">
202208
Link Text
203209
</Text>
204210

0 commit comments

Comments
 (0)