Skip to content

Commit e512a03

Browse files
shubh73claude
andcommitted
Add an RNTester example and visual test for changing to per-side border colors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 0bc25df commit e512a03

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

‎packages/rn-tester/js/examples/Border/BorderExample.js‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,41 @@
1313
import type {RNTesterModule} from '../../types/RNTesterTypes';
1414

1515
import hotdog from '../../assets/hotdog.jpg';
16+
import RNTesterText from '../../components/RNTesterText';
1617
import * as React from 'react';
18+
import {useState} from 'react';
1719
import {
1820
DynamicColorIOS,
1921
Image,
2022
Platform,
2123
PlatformColor,
24+
Pressable,
2225
StyleSheet,
2326
View,
2427
} from 'react-native';
2528

29+
function BorderColorChangeExample(): React.Node {
30+
const [perSide, setPerSide] = useState(false);
31+
return (
32+
<Pressable
33+
testID="border-color-change-button"
34+
onPress={() => setPerSide(value => !value)}>
35+
<RNTesterText>
36+
{perSide ? 'Per-side colors' : 'One color'} (tap to change)
37+
</RNTesterText>
38+
<View testID="border-test-color-change" style={{padding: 10}}>
39+
<View
40+
style={[
41+
styles.box,
42+
{borderWidth: 10},
43+
perSide ? styles.border2 : {borderColor: 'black'},
44+
]}
45+
/>
46+
</View>
47+
</Pressable>
48+
);
49+
}
50+
2651
const styles = StyleSheet.create({
2752
box: {
2853
width: 100,
@@ -600,6 +625,15 @@ export default {
600625
);
601626
},
602627
},
628+
{
629+
title: 'Changing to per-side colors',
630+
name: 'color-change',
631+
description:
632+
'A border that changes from one color to per-side colors stays inside the view',
633+
render: function (): React.Node {
634+
return <BorderColorChangeExample />;
635+
},
636+
},
603637
{
604638
title: 'Borders and scaling transforms',
605639
name: 'scaling-transforms',

‎packages/rn-tester/visual-tests/flows/border.yml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,23 @@ appId: ${APP_ID}
4242
path: ${VISUAL_OUTPUT_DIR}/border/equal-width-borders/default
4343
cropOn:
4444
id: 'border-test-equal-width-borders'
45+
- runFlow:
46+
file: ../helpers/open-example.yml
47+
env:
48+
EXAMPLE_URL: rntester://example/BorderExample/color-change
49+
- extendedWaitUntil:
50+
visible:
51+
id: 'border-test-color-change'
52+
timeout: 15000
53+
- tapOn:
54+
id: 'border-color-change-button'
55+
- extendedWaitUntil:
56+
visible:
57+
text: 'Per-side colors.*'
58+
timeout: 15000
59+
- waitForAnimationToEnd:
60+
timeout: 5000
61+
- takeScreenshot:
62+
path: ${VISUAL_OUTPUT_DIR}/border/color-change/per-side-colors
63+
cropOn:
64+
id: 'border-test-color-change'

‎packages/rn-tester/visual-tests/suites/border.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
| `corner-radii` | Initial rendering |
66
| `child-clipping-radius` | Initial rendering |
77
| `equal-width-borders` | Initial rendering |
8+
| `color-change` | After tapping to change from one border color to per-side colors |
89

910
Screenshots use the existing RNTester example crops. Each example starts from a fresh app launch; captures wait for the target and for animations to settle.

0 commit comments

Comments
 (0)