@terreno/ui 0.22.2 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/Accordion.js +3 -3
- package/dist/Accordion.js.map +1 -1
- package/dist/BooleanField.js +6 -4
- package/dist/BooleanField.js.map +1 -1
- package/dist/Box.js +3 -2
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +4 -3
- package/dist/Button.js.map +1 -1
- package/dist/CheckBox.js +2 -2
- package/dist/CheckBox.js.map +1 -1
- package/dist/Common.d.ts +44 -56
- package/dist/Common.js +1 -0
- package/dist/Common.js.map +1 -1
- package/dist/CustomSelectField.js +5 -3
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.js +18 -12
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +5 -3
- package/dist/DateTimeField.js.map +1 -1
- package/dist/IconButton.js +8 -4
- package/dist/IconButton.js.map +1 -1
- package/dist/Link.js +2 -2
- package/dist/Link.js.map +1 -1
- package/dist/MarkdownEditor.js +14 -2
- package/dist/MarkdownEditor.js.map +1 -1
- package/dist/MarkdownEditorField.js +18 -4
- package/dist/MarkdownEditorField.js.map +1 -1
- package/dist/Modal.js +10 -6
- package/dist/Modal.js.map +1 -1
- package/dist/MultiselectField.js +5 -3
- package/dist/MultiselectField.js.map +1 -1
- package/dist/Page.js +1 -1
- package/dist/Page.js.map +1 -1
- package/dist/Pagination.js +2 -2
- package/dist/Pagination.js.map +1 -1
- package/dist/SegmentedControl.js +5 -3
- package/dist/SegmentedControl.js.map +1 -1
- package/dist/SelectField.js +5 -3
- package/dist/SelectField.js.map +1 -1
- package/dist/SocialLoginButton.js +2 -1
- package/dist/SocialLoginButton.js.map +1 -1
- package/dist/Spinner.js +3 -2
- package/dist/Spinner.js.map +1 -1
- package/dist/TextField.js +6 -4
- package/dist/TextField.js.map +1 -1
- package/dist/fieldElements/FieldError.d.ts +1 -0
- package/dist/fieldElements/FieldError.js +3 -2
- package/dist/fieldElements/FieldError.js.map +1 -1
- package/dist/fieldElements/FieldHelperText.d.ts +1 -0
- package/dist/fieldElements/FieldHelperText.js +3 -2
- package/dist/fieldElements/FieldHelperText.js.map +1 -1
- package/dist/fieldElements/FieldTitle.d.ts +1 -0
- package/dist/fieldElements/FieldTitle.js +4 -3
- package/dist/fieldElements/FieldTitle.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/resolveTestId.d.ts +39 -0
- package/dist/testing/resolveTestId.js +97 -0
- package/dist/testing/resolveTestId.js.map +1 -0
- package/dist/testing/types.d.ts +59 -0
- package/dist/testing/types.js +2 -0
- package/dist/testing/types.js.map +1 -0
- package/package.json +2 -2
- package/src/Accordion.tsx +3 -1
- package/src/BooleanField.tsx +13 -3
- package/src/Box.tsx +3 -2
- package/src/Button.test.tsx +31 -1
- package/src/Button.tsx +5 -4
- package/src/CheckBox.tsx +7 -1
- package/src/Common.ts +66 -58
- package/src/CustomSelectField.tsx +8 -1
- package/src/DataTable.tsx +40 -3
- package/src/DateTimeField.tsx +10 -3
- package/src/ErrorBoundary.test.tsx +3 -4
- package/src/IconButton.test.tsx +14 -0
- package/src/IconButton.tsx +9 -4
- package/src/Link.tsx +2 -1
- package/src/MarkdownEditor.tsx +52 -27
- package/src/MarkdownEditorField.tsx +37 -16
- package/src/Modal.tsx +13 -0
- package/src/MultiselectField.tsx +8 -3
- package/src/Page.tsx +1 -0
- package/src/Pagination.tsx +2 -1
- package/src/SegmentedControl.tsx +15 -2
- package/src/SelectField.tsx +8 -3
- package/src/SocialLoginButton.tsx +2 -1
- package/src/Spinner.tsx +3 -2
- package/src/TextField.tsx +8 -5
- package/src/__snapshots__/AddressField.test.tsx.snap +4 -0
- package/src/__snapshots__/BooleanField.test.tsx.snap +4 -0
- package/src/__snapshots__/Button.test.tsx.snap +18 -1
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +2 -0
- package/src/__snapshots__/ErrorPage.test.tsx.snap +1 -0
- package/src/__snapshots__/Field.test.tsx.snap +8 -0
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +2 -0
- package/src/__snapshots__/HeightField.test.tsx.snap +5 -0
- package/src/__snapshots__/IconButton.test.tsx.snap +4 -0
- package/src/__snapshots__/InfoModalIcon.test.tsx.snap +4 -0
- package/src/__snapshots__/Link.test.tsx.snap +1 -0
- package/src/__snapshots__/Modal.test.tsx.snap +3 -0
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +2 -0
- package/src/__snapshots__/Page.test.tsx.snap +22 -0
- package/src/__snapshots__/SegmentedControl.test.tsx.snap +4 -0
- package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +1 -0
- package/src/fieldElements/FieldError.tsx +7 -2
- package/src/fieldElements/FieldHelperText.tsx +4 -2
- package/src/fieldElements/FieldTitle.tsx +4 -1
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +7 -0
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +7 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/resolveTestId.test.ts +231 -0
- package/src/testing/resolveTestId.ts +142 -0
- package/src/testing/types.ts +67 -0
|
@@ -544,6 +544,7 @@ exports[`Modal renders with both buttons 1`] = `
|
|
|
544
544
|
"borderRadius": 360,
|
|
545
545
|
"borderWidth": undefined,
|
|
546
546
|
"flexDirection": "column",
|
|
547
|
+
"height": undefined,
|
|
547
548
|
"justifyContent": "center",
|
|
548
549
|
"paddingHorizontal": 20,
|
|
549
550
|
"paddingVertical": 8,
|
|
@@ -621,6 +622,7 @@ exports[`Modal renders with both buttons 1`] = `
|
|
|
621
622
|
"borderRadius": 360,
|
|
622
623
|
"borderWidth": undefined,
|
|
623
624
|
"flexDirection": "column",
|
|
625
|
+
"height": undefined,
|
|
624
626
|
"justifyContent": "center",
|
|
625
627
|
"paddingHorizontal": 20,
|
|
626
628
|
"paddingVertical": 8,
|
|
@@ -871,6 +873,7 @@ exports[`Modal renders with disabled primary button 1`] = `
|
|
|
871
873
|
"borderRadius": 360,
|
|
872
874
|
"borderWidth": undefined,
|
|
873
875
|
"flexDirection": "column",
|
|
876
|
+
"height": undefined,
|
|
874
877
|
"justifyContent": "center",
|
|
875
878
|
"paddingHorizontal": 20,
|
|
876
879
|
"paddingVertical": 8,
|
|
@@ -183,6 +183,7 @@ exports[`NumberPickerActionSheet renders correctly 1`] = `
|
|
|
183
183
|
"borderRadius": 360,
|
|
184
184
|
"borderWidth": undefined,
|
|
185
185
|
"flexDirection": "column",
|
|
186
|
+
"height": undefined,
|
|
186
187
|
"justifyContent": "center",
|
|
187
188
|
"paddingHorizontal": 20,
|
|
188
189
|
"paddingVertical": 8,
|
|
@@ -1515,6 +1516,7 @@ exports[`NumberPickerActionSheet renders with different range 1`] = `
|
|
|
1515
1516
|
"borderRadius": 360,
|
|
1516
1517
|
"borderWidth": undefined,
|
|
1517
1518
|
"flexDirection": "column",
|
|
1519
|
+
"height": undefined,
|
|
1518
1520
|
"justifyContent": "center",
|
|
1519
1521
|
"paddingHorizontal": 20,
|
|
1520
1522
|
"paddingVertical": 8,
|
|
@@ -56,6 +56,7 @@ exports[`Page renders correctly with default props 1`] = `
|
|
|
56
56
|
"maxWidth": 800,
|
|
57
57
|
"padding": 8,
|
|
58
58
|
"scroll": true,
|
|
59
|
+
"testID": undefined,
|
|
59
60
|
"width": "100%",
|
|
60
61
|
},
|
|
61
62
|
"testID": undefined,
|
|
@@ -91,6 +92,7 @@ exports[`Page renders correctly with default props 1`] = `
|
|
|
91
92
|
"maxWidth": 800,
|
|
92
93
|
"padding": 8,
|
|
93
94
|
"scroll": true,
|
|
95
|
+
"testID": undefined,
|
|
94
96
|
"width": "100%",
|
|
95
97
|
},
|
|
96
98
|
},
|
|
@@ -227,6 +229,7 @@ exports[`Page renders with title 1`] = `
|
|
|
227
229
|
"maxWidth": 800,
|
|
228
230
|
"padding": 8,
|
|
229
231
|
"scroll": true,
|
|
232
|
+
"testID": undefined,
|
|
230
233
|
"width": "100%",
|
|
231
234
|
},
|
|
232
235
|
"testID": undefined,
|
|
@@ -262,6 +265,7 @@ exports[`Page renders with title 1`] = `
|
|
|
262
265
|
"maxWidth": 800,
|
|
263
266
|
"padding": 8,
|
|
264
267
|
"scroll": true,
|
|
268
|
+
"testID": undefined,
|
|
265
269
|
"width": "100%",
|
|
266
270
|
},
|
|
267
271
|
},
|
|
@@ -439,6 +443,7 @@ exports[`Page renders with back button 1`] = `
|
|
|
439
443
|
"maxWidth": 800,
|
|
440
444
|
"padding": 8,
|
|
441
445
|
"scroll": true,
|
|
446
|
+
"testID": undefined,
|
|
442
447
|
"width": "100%",
|
|
443
448
|
},
|
|
444
449
|
"testID": undefined,
|
|
@@ -474,6 +479,7 @@ exports[`Page renders with back button 1`] = `
|
|
|
474
479
|
"maxWidth": 800,
|
|
475
480
|
"padding": 8,
|
|
476
481
|
"scroll": true,
|
|
482
|
+
"testID": undefined,
|
|
477
483
|
"width": "100%",
|
|
478
484
|
},
|
|
479
485
|
},
|
|
@@ -651,6 +657,7 @@ exports[`Page renders with close button 1`] = `
|
|
|
651
657
|
"maxWidth": 800,
|
|
652
658
|
"padding": 8,
|
|
653
659
|
"scroll": true,
|
|
660
|
+
"testID": undefined,
|
|
654
661
|
"width": "100%",
|
|
655
662
|
},
|
|
656
663
|
"testID": undefined,
|
|
@@ -686,6 +693,7 @@ exports[`Page renders with close button 1`] = `
|
|
|
686
693
|
"maxWidth": 800,
|
|
687
694
|
"padding": 8,
|
|
688
695
|
"scroll": true,
|
|
696
|
+
"testID": undefined,
|
|
689
697
|
"width": "100%",
|
|
690
698
|
},
|
|
691
699
|
},
|
|
@@ -827,6 +835,7 @@ exports[`Page renders with right button 1`] = `
|
|
|
827
835
|
"borderRadius": 360,
|
|
828
836
|
"borderWidth": undefined,
|
|
829
837
|
"flexDirection": "column",
|
|
838
|
+
"height": undefined,
|
|
830
839
|
"justifyContent": "center",
|
|
831
840
|
"paddingHorizontal": 20,
|
|
832
841
|
"paddingVertical": 8,
|
|
@@ -909,6 +918,7 @@ exports[`Page renders with right button 1`] = `
|
|
|
909
918
|
"maxWidth": 800,
|
|
910
919
|
"padding": 8,
|
|
911
920
|
"scroll": true,
|
|
921
|
+
"testID": undefined,
|
|
912
922
|
"width": "100%",
|
|
913
923
|
},
|
|
914
924
|
"testID": undefined,
|
|
@@ -944,6 +954,7 @@ exports[`Page renders with right button 1`] = `
|
|
|
944
954
|
"maxWidth": 800,
|
|
945
955
|
"padding": 8,
|
|
946
956
|
"scroll": true,
|
|
957
|
+
"testID": undefined,
|
|
947
958
|
"width": "100%",
|
|
948
959
|
},
|
|
949
960
|
},
|
|
@@ -1022,6 +1033,7 @@ exports[`Page renders loading state 1`] = `
|
|
|
1022
1033
|
"maxWidth": 800,
|
|
1023
1034
|
"padding": 8,
|
|
1024
1035
|
"scroll": true,
|
|
1036
|
+
"testID": undefined,
|
|
1025
1037
|
"width": "100%",
|
|
1026
1038
|
},
|
|
1027
1039
|
"testID": undefined,
|
|
@@ -1057,6 +1069,7 @@ exports[`Page renders loading state 1`] = `
|
|
|
1057
1069
|
"maxWidth": 800,
|
|
1058
1070
|
"padding": 8,
|
|
1059
1071
|
"scroll": true,
|
|
1072
|
+
"testID": undefined,
|
|
1060
1073
|
"width": "100%",
|
|
1061
1074
|
},
|
|
1062
1075
|
},
|
|
@@ -1141,6 +1154,7 @@ exports[`Page renders with footer 1`] = `
|
|
|
1141
1154
|
"maxWidth": 800,
|
|
1142
1155
|
"padding": 8,
|
|
1143
1156
|
"scroll": true,
|
|
1157
|
+
"testID": undefined,
|
|
1144
1158
|
"width": "100%",
|
|
1145
1159
|
},
|
|
1146
1160
|
"testID": undefined,
|
|
@@ -1176,6 +1190,7 @@ exports[`Page renders with footer 1`] = `
|
|
|
1176
1190
|
"maxWidth": 800,
|
|
1177
1191
|
"padding": 8,
|
|
1178
1192
|
"scroll": true,
|
|
1193
|
+
"testID": undefined,
|
|
1179
1194
|
"width": "100%",
|
|
1180
1195
|
},
|
|
1181
1196
|
},
|
|
@@ -1311,6 +1326,7 @@ exports[`Page renders with custom padding 1`] = `
|
|
|
1311
1326
|
"maxWidth": 800,
|
|
1312
1327
|
"padding": 24,
|
|
1313
1328
|
"scroll": true,
|
|
1329
|
+
"testID": undefined,
|
|
1314
1330
|
"width": "100%",
|
|
1315
1331
|
},
|
|
1316
1332
|
"testID": undefined,
|
|
@@ -1346,6 +1362,7 @@ exports[`Page renders with custom padding 1`] = `
|
|
|
1346
1362
|
"maxWidth": 800,
|
|
1347
1363
|
"padding": 24,
|
|
1348
1364
|
"scroll": true,
|
|
1365
|
+
"testID": undefined,
|
|
1349
1366
|
"width": "100%",
|
|
1350
1367
|
},
|
|
1351
1368
|
},
|
|
@@ -1429,6 +1446,7 @@ exports[`Page renders with custom color 1`] = `
|
|
|
1429
1446
|
"maxWidth": 800,
|
|
1430
1447
|
"padding": 8,
|
|
1431
1448
|
"scroll": true,
|
|
1449
|
+
"testID": undefined,
|
|
1432
1450
|
"width": "100%",
|
|
1433
1451
|
},
|
|
1434
1452
|
"testID": undefined,
|
|
@@ -1464,6 +1482,7 @@ exports[`Page renders with custom color 1`] = `
|
|
|
1464
1482
|
"maxWidth": 800,
|
|
1465
1483
|
"padding": 8,
|
|
1466
1484
|
"scroll": true,
|
|
1485
|
+
"testID": undefined,
|
|
1467
1486
|
"width": "100%",
|
|
1468
1487
|
},
|
|
1469
1488
|
},
|
|
@@ -1544,6 +1563,7 @@ exports[`Page renders with scroll disabled 1`] = `
|
|
|
1544
1563
|
"maxWidth": 800,
|
|
1545
1564
|
"padding": 8,
|
|
1546
1565
|
"scroll": false,
|
|
1566
|
+
"testID": undefined,
|
|
1547
1567
|
"width": "100%",
|
|
1548
1568
|
},
|
|
1549
1569
|
"testID": undefined,
|
|
@@ -1628,6 +1648,7 @@ exports[`Page renders with custom maxWidth 1`] = `
|
|
|
1628
1648
|
"maxWidth": 600,
|
|
1629
1649
|
"padding": 8,
|
|
1630
1650
|
"scroll": true,
|
|
1651
|
+
"testID": undefined,
|
|
1631
1652
|
"width": "100%",
|
|
1632
1653
|
},
|
|
1633
1654
|
"testID": undefined,
|
|
@@ -1663,6 +1684,7 @@ exports[`Page renders with custom maxWidth 1`] = `
|
|
|
1663
1684
|
"maxWidth": 600,
|
|
1664
1685
|
"padding": 8,
|
|
1665
1686
|
"scroll": true,
|
|
1687
|
+
"testID": undefined,
|
|
1666
1688
|
"width": "100%",
|
|
1667
1689
|
},
|
|
1668
1690
|
},
|
|
@@ -1049,6 +1049,7 @@ exports[`SegmentedControl renders with maxItems and scroll buttons 1`] = `
|
|
|
1049
1049
|
"props": {
|
|
1050
1050
|
"disabled": true,
|
|
1051
1051
|
"onPress": [Function],
|
|
1052
|
+
"testID": undefined,
|
|
1052
1053
|
},
|
|
1053
1054
|
"type": "Pressable",
|
|
1054
1055
|
},
|
|
@@ -1216,6 +1217,7 @@ exports[`SegmentedControl renders with maxItems and scroll buttons 1`] = `
|
|
|
1216
1217
|
"props": {
|
|
1217
1218
|
"disabled": false,
|
|
1218
1219
|
"onPress": [Function],
|
|
1220
|
+
"testID": undefined,
|
|
1219
1221
|
},
|
|
1220
1222
|
"type": "Pressable",
|
|
1221
1223
|
},
|
|
@@ -1243,6 +1245,7 @@ exports[`SegmentedControl handles scroll navigation 1`] = `
|
|
|
1243
1245
|
"props": {
|
|
1244
1246
|
"disabled": true,
|
|
1245
1247
|
"onPress": [Function],
|
|
1248
|
+
"testID": undefined,
|
|
1246
1249
|
},
|
|
1247
1250
|
"type": "Pressable",
|
|
1248
1251
|
},
|
|
@@ -1410,6 +1413,7 @@ exports[`SegmentedControl handles scroll navigation 1`] = `
|
|
|
1410
1413
|
"props": {
|
|
1411
1414
|
"disabled": false,
|
|
1412
1415
|
"onPress": [Function],
|
|
1416
|
+
"testID": undefined,
|
|
1413
1417
|
},
|
|
1414
1418
|
"type": "Pressable",
|
|
1415
1419
|
},
|
|
@@ -5,16 +5,21 @@ import {Text, View} from "react-native";
|
|
|
5
5
|
|
|
6
6
|
import {Icon} from "../Icon";
|
|
7
7
|
import {useTheme} from "../Theme";
|
|
8
|
+
import {toTestProps} from "../testing/resolveTestId";
|
|
8
9
|
|
|
9
10
|
interface FieldErrorProps {
|
|
10
11
|
text: string;
|
|
12
|
+
testID?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const FieldError: FC<FieldErrorProps> = ({text}) => {
|
|
15
|
+
export const FieldError: FC<FieldErrorProps> = ({text, testID}) => {
|
|
14
16
|
const {theme} = useTheme();
|
|
15
17
|
|
|
16
18
|
return (
|
|
17
|
-
<View
|
|
19
|
+
<View
|
|
20
|
+
style={{alignItems: "center", flexDirection: "row", marginVertical: 2}}
|
|
21
|
+
{...toTestProps(testID)}
|
|
22
|
+
>
|
|
18
23
|
<Icon color="error" iconName="triangle-exclamation" size="sm" />
|
|
19
24
|
<View style={{marginLeft: 4}}>
|
|
20
25
|
<Text style={{color: theme.text.error, fontSize: 12}}>{text}</Text>
|
|
@@ -4,16 +4,18 @@ import type {FC} from "react";
|
|
|
4
4
|
import {Text, View} from "react-native";
|
|
5
5
|
|
|
6
6
|
import {useTheme} from "../Theme";
|
|
7
|
+
import {toTestProps} from "../testing/resolveTestId";
|
|
7
8
|
|
|
8
9
|
interface FieldHelperTextProps {
|
|
9
10
|
text: string;
|
|
11
|
+
testID?: string;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export const FieldHelperText: FC<FieldHelperTextProps> = ({text}) => {
|
|
14
|
+
export const FieldHelperText: FC<FieldHelperTextProps> = ({text, testID}) => {
|
|
13
15
|
const {theme} = useTheme();
|
|
14
16
|
|
|
15
17
|
return (
|
|
16
|
-
<View style={{marginTop: 2}}>
|
|
18
|
+
<View style={{marginTop: 2}} {...toTestProps(testID)}>
|
|
17
19
|
<Text style={{color: theme.text.primary, fontSize: 12, lineHeight: 16}}>{text}</Text>
|
|
18
20
|
</View>
|
|
19
21
|
);
|
|
@@ -6,13 +6,15 @@ import {Text} from "react-native";
|
|
|
6
6
|
|
|
7
7
|
import {isMobileDevice} from "../MediaQuery";
|
|
8
8
|
import {useTheme} from "../Theme";
|
|
9
|
+
import {toTestProps} from "../testing/resolveTestId";
|
|
9
10
|
import {isNative} from "../Utilities";
|
|
10
11
|
|
|
11
12
|
interface FieldTitleProps {
|
|
12
13
|
text: string;
|
|
14
|
+
testID?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export const FieldTitle: FC<FieldTitleProps> = ({text}) => {
|
|
17
|
+
export const FieldTitle: FC<FieldTitleProps> = ({text, testID}) => {
|
|
16
18
|
const {theme} = useTheme();
|
|
17
19
|
const isMobileOrNative = isMobileDevice() || isNative();
|
|
18
20
|
|
|
@@ -24,6 +26,7 @@ export const FieldTitle: FC<FieldTitleProps> = ({text}) => {
|
|
|
24
26
|
fontWeight: 600,
|
|
25
27
|
lineHeight: 22.4,
|
|
26
28
|
}}
|
|
29
|
+
{...toTestProps(testID)}
|
|
27
30
|
>
|
|
28
31
|
{text}
|
|
29
32
|
</Text>
|
|
@@ -64,6 +64,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
64
64
|
"fontWeight": 600,
|
|
65
65
|
"lineHeight": 22.4,
|
|
66
66
|
},
|
|
67
|
+
"testID": "login-screen-email-input.label",
|
|
67
68
|
},
|
|
68
69
|
"type": "Text",
|
|
69
70
|
},
|
|
@@ -169,6 +170,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
169
170
|
"fontWeight": 600,
|
|
170
171
|
"lineHeight": 22.4,
|
|
171
172
|
},
|
|
173
|
+
"testID": "login-screen-password-input.label",
|
|
172
174
|
},
|
|
173
175
|
"type": "Text",
|
|
174
176
|
},
|
|
@@ -369,6 +371,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
369
371
|
"borderRadius": 360,
|
|
370
372
|
"borderWidth": undefined,
|
|
371
373
|
"flexDirection": "column",
|
|
374
|
+
"height": undefined,
|
|
372
375
|
"justifyContent": "center",
|
|
373
376
|
"paddingHorizontal": 20,
|
|
374
377
|
"paddingVertical": 8,
|
|
@@ -451,6 +454,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
451
454
|
"borderRadius": 360,
|
|
452
455
|
"borderWidth": undefined,
|
|
453
456
|
"flexDirection": "column",
|
|
457
|
+
"height": undefined,
|
|
454
458
|
"justifyContent": "center",
|
|
455
459
|
"paddingHorizontal": 20,
|
|
456
460
|
"paddingVertical": 8,
|
|
@@ -534,6 +538,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
534
538
|
"borderRadius": 360,
|
|
535
539
|
"borderWidth": undefined,
|
|
536
540
|
"flexDirection": "column",
|
|
541
|
+
"height": undefined,
|
|
537
542
|
"justifyContent": "center",
|
|
538
543
|
"paddingHorizontal": 20,
|
|
539
544
|
"paddingVertical": 8,
|
|
@@ -604,6 +609,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
604
609
|
"maxWidth": 800,
|
|
605
610
|
"padding": 8,
|
|
606
611
|
"scroll": true,
|
|
612
|
+
"testID": undefined,
|
|
607
613
|
"width": "100%",
|
|
608
614
|
},
|
|
609
615
|
"testID": undefined,
|
|
@@ -639,6 +645,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
639
645
|
"maxWidth": 800,
|
|
640
646
|
"padding": 8,
|
|
641
647
|
"scroll": true,
|
|
648
|
+
"testID": undefined,
|
|
642
649
|
"width": "100%",
|
|
643
650
|
},
|
|
644
651
|
},
|
|
@@ -64,6 +64,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
64
64
|
"fontWeight": 600,
|
|
65
65
|
"lineHeight": 22.4,
|
|
66
66
|
},
|
|
67
|
+
"testID": "signup-screen-name-input.label",
|
|
67
68
|
},
|
|
68
69
|
"type": "Text",
|
|
69
70
|
},
|
|
@@ -169,6 +170,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
169
170
|
"fontWeight": 600,
|
|
170
171
|
"lineHeight": 22.4,
|
|
171
172
|
},
|
|
173
|
+
"testID": "signup-screen-email-input.label",
|
|
172
174
|
},
|
|
173
175
|
"type": "Text",
|
|
174
176
|
},
|
|
@@ -274,6 +276,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
274
276
|
"fontWeight": 600,
|
|
275
277
|
"lineHeight": 22.4,
|
|
276
278
|
},
|
|
279
|
+
"testID": "signup-screen-password-input.label",
|
|
277
280
|
},
|
|
278
281
|
"type": "Text",
|
|
279
282
|
},
|
|
@@ -708,6 +711,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
708
711
|
"borderRadius": 360,
|
|
709
712
|
"borderWidth": undefined,
|
|
710
713
|
"flexDirection": "column",
|
|
714
|
+
"height": undefined,
|
|
711
715
|
"justifyContent": "center",
|
|
712
716
|
"paddingHorizontal": 20,
|
|
713
717
|
"paddingVertical": 8,
|
|
@@ -790,6 +794,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
790
794
|
"borderRadius": 360,
|
|
791
795
|
"borderWidth": undefined,
|
|
792
796
|
"flexDirection": "column",
|
|
797
|
+
"height": undefined,
|
|
793
798
|
"justifyContent": "center",
|
|
794
799
|
"paddingHorizontal": 20,
|
|
795
800
|
"paddingVertical": 8,
|
|
@@ -860,6 +865,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
860
865
|
"maxWidth": 800,
|
|
861
866
|
"padding": 8,
|
|
862
867
|
"scroll": true,
|
|
868
|
+
"testID": undefined,
|
|
863
869
|
"width": "100%",
|
|
864
870
|
},
|
|
865
871
|
"testID": undefined,
|
|
@@ -895,6 +901,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
895
901
|
"maxWidth": 800,
|
|
896
902
|
"padding": 8,
|
|
897
903
|
"scroll": true,
|
|
904
|
+
"testID": undefined,
|
|
898
905
|
"width": "100%",
|
|
899
906
|
},
|
|
900
907
|
},
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import {describe, expect, it} from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
resolveDataTableRowTestID,
|
|
5
|
+
resolveDataTableTestIDs,
|
|
6
|
+
resolveDataTableTestIDsFromProps,
|
|
7
|
+
resolveFieldTestIDs,
|
|
8
|
+
resolveFieldTestIDsFromProps,
|
|
9
|
+
resolveModalTestIDs,
|
|
10
|
+
resolveModalTestIDsFromProps,
|
|
11
|
+
resolveSegmentedControlTestIDs,
|
|
12
|
+
resolveSegmentedControlTestIDsFromProps,
|
|
13
|
+
resolveTestID,
|
|
14
|
+
toDomTestProps,
|
|
15
|
+
toPlatformTestProps,
|
|
16
|
+
toTestProps,
|
|
17
|
+
} from "./resolveTestId";
|
|
18
|
+
|
|
19
|
+
describe("resolveTestID", () => {
|
|
20
|
+
it("returns base when part is omitted", () => {
|
|
21
|
+
expect(resolveTestID("login")).toBe("login");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("joins base and part with a dot", () => {
|
|
25
|
+
expect(resolveTestID("login", "email")).toBe("login.email");
|
|
26
|
+
expect(resolveTestID("login.email", "input")).toBe("login.email.input");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("returns undefined when base is absent", () => {
|
|
30
|
+
expect(resolveTestID(undefined, "input")).toBeUndefined();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe("toTestProps", () => {
|
|
35
|
+
it("returns testID for React Native components", () => {
|
|
36
|
+
expect(toTestProps("submit")).toEqual({testID: "submit"});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("returns empty object when id is absent", () => {
|
|
40
|
+
expect(toTestProps(undefined)).toEqual({});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("toDomTestProps", () => {
|
|
45
|
+
it("returns data-testid for DOM elements", () => {
|
|
46
|
+
expect(toDomTestProps("submit")).toEqual({"data-testid": "submit"});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("returns empty object when id is absent", () => {
|
|
50
|
+
expect(toDomTestProps(undefined)).toEqual({});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("toPlatformTestProps", () => {
|
|
55
|
+
it("returns empty object when id is absent", () => {
|
|
56
|
+
expect(toPlatformTestProps(undefined)).toEqual({});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("returns testID on non-web platforms", () => {
|
|
60
|
+
const result = toPlatformTestProps("my-button");
|
|
61
|
+
expect(result.testID ?? result["data-testid"]).toBeDefined();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("resolveFieldTestIDs", () => {
|
|
66
|
+
it("applies dot-suffix defaults", () => {
|
|
67
|
+
expect(resolveFieldTestIDs("signup.email")).toEqual({
|
|
68
|
+
error: "signup.email.error",
|
|
69
|
+
helper: "signup.email.helper",
|
|
70
|
+
input: "signup.email",
|
|
71
|
+
label: "signup.email.label",
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("allows testIDs overrides", () => {
|
|
76
|
+
expect(
|
|
77
|
+
resolveFieldTestIDs("signup.email", {
|
|
78
|
+
input: "custom-input",
|
|
79
|
+
label: "custom-label",
|
|
80
|
+
})
|
|
81
|
+
).toEqual({
|
|
82
|
+
error: "signup.email.error",
|
|
83
|
+
helper: "signup.email.helper",
|
|
84
|
+
input: "custom-input",
|
|
85
|
+
label: "custom-label",
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe("resolveModalTestIDs", () => {
|
|
91
|
+
it("applies dot-suffix defaults", () => {
|
|
92
|
+
expect(resolveModalTestIDs("confirm-delete")).toEqual({
|
|
93
|
+
dismiss: "confirm-delete.dismiss",
|
|
94
|
+
primaryButton: "confirm-delete.primary",
|
|
95
|
+
root: "confirm-delete",
|
|
96
|
+
secondaryButton: "confirm-delete.secondary",
|
|
97
|
+
title: "confirm-delete.title",
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
describe("resolveFieldTestIDsFromProps", () => {
|
|
103
|
+
it("resolves from props with testID", () => {
|
|
104
|
+
const result = resolveFieldTestIDsFromProps({testID: "email"});
|
|
105
|
+
expect(result.input).toBe("email");
|
|
106
|
+
expect(result.label).toBe("email.label");
|
|
107
|
+
expect(result.error).toBe("email.error");
|
|
108
|
+
expect(result.helper).toBe("email.helper");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("uses testIDs overrides from props", () => {
|
|
112
|
+
const result = resolveFieldTestIDsFromProps({
|
|
113
|
+
testID: "email",
|
|
114
|
+
testIDs: {input: "custom-input"},
|
|
115
|
+
});
|
|
116
|
+
expect(result.input).toBe("custom-input");
|
|
117
|
+
expect(result.label).toBe("email.label");
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("resolveModalTestIDsFromProps", () => {
|
|
122
|
+
it("resolves from props with testID", () => {
|
|
123
|
+
const result = resolveModalTestIDsFromProps({testID: "dialog"});
|
|
124
|
+
expect(result.root).toBe("dialog");
|
|
125
|
+
expect(result.dismiss).toBe("dialog.dismiss");
|
|
126
|
+
expect(result.primaryButton).toBe("dialog.primary");
|
|
127
|
+
expect(result.secondaryButton).toBe("dialog.secondary");
|
|
128
|
+
expect(result.title).toBe("dialog.title");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("uses testIDs overrides from props", () => {
|
|
132
|
+
const result = resolveModalTestIDsFromProps({
|
|
133
|
+
testID: "dialog",
|
|
134
|
+
testIDs: {dismiss: "close-btn"},
|
|
135
|
+
});
|
|
136
|
+
expect(result.dismiss).toBe("close-btn");
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
describe("resolveDataTableTestIDs", () => {
|
|
141
|
+
it("applies dot-suffix defaults", () => {
|
|
142
|
+
expect(resolveDataTableTestIDs("users-table")).toEqual({
|
|
143
|
+
body: "users-table.body",
|
|
144
|
+
header: "users-table.header",
|
|
145
|
+
pagination: "users-table.pagination",
|
|
146
|
+
root: "users-table",
|
|
147
|
+
row: "users-table.row",
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it("allows testIDs overrides", () => {
|
|
152
|
+
expect(
|
|
153
|
+
resolveDataTableTestIDs("users-table", {header: "custom-header", root: "custom-root"})
|
|
154
|
+
).toEqual({
|
|
155
|
+
body: "users-table.body",
|
|
156
|
+
header: "custom-header",
|
|
157
|
+
pagination: "users-table.pagination",
|
|
158
|
+
root: "custom-root",
|
|
159
|
+
row: "users-table.row",
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("returns undefined-based results when base is absent", () => {
|
|
164
|
+
const result = resolveDataTableTestIDs(undefined);
|
|
165
|
+
expect(result.root).toBeUndefined();
|
|
166
|
+
expect(result.header).toBeUndefined();
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
describe("resolveDataTableTestIDsFromProps", () => {
|
|
171
|
+
it("resolves from props with testID", () => {
|
|
172
|
+
const result = resolveDataTableTestIDsFromProps({testID: "table"});
|
|
173
|
+
expect(result.root).toBe("table");
|
|
174
|
+
expect(result.body).toBe("table.body");
|
|
175
|
+
expect(result.row).toBe("table.row");
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe("resolveDataTableRowTestID", () => {
|
|
180
|
+
it("appends row key to row test id base", () => {
|
|
181
|
+
expect(resolveDataTableRowTestID("users-table.row", "abc123")).toBe("users-table.row-abc123");
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("handles numeric row keys", () => {
|
|
185
|
+
expect(resolveDataTableRowTestID("table.row", 42)).toBe("table.row-42");
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("returns undefined when base is absent", () => {
|
|
189
|
+
expect(resolveDataTableRowTestID(undefined, "abc123")).toBeUndefined();
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe("resolveSegmentedControlTestIDs", () => {
|
|
194
|
+
it("applies dot-suffix defaults", () => {
|
|
195
|
+
expect(resolveSegmentedControlTestIDs("schedule.nav")).toEqual({
|
|
196
|
+
nextButton: "schedule.nav.next",
|
|
197
|
+
previousButton: "schedule.nav.previous",
|
|
198
|
+
root: "schedule.nav",
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it("allows testIDs overrides", () => {
|
|
203
|
+
expect(
|
|
204
|
+
resolveSegmentedControlTestIDs("schedule.nav", {
|
|
205
|
+
nextButton: "custom-next",
|
|
206
|
+
previousButton: "custom-previous",
|
|
207
|
+
})
|
|
208
|
+
).toEqual({
|
|
209
|
+
nextButton: "custom-next",
|
|
210
|
+
previousButton: "custom-previous",
|
|
211
|
+
root: "schedule.nav",
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe("resolveSegmentedControlTestIDsFromProps", () => {
|
|
217
|
+
it("resolves using component props", () => {
|
|
218
|
+
expect(
|
|
219
|
+
resolveSegmentedControlTestIDsFromProps({
|
|
220
|
+
testID: "schedule.nav",
|
|
221
|
+
testIDs: {
|
|
222
|
+
root: "custom-root",
|
|
223
|
+
},
|
|
224
|
+
})
|
|
225
|
+
).toEqual({
|
|
226
|
+
nextButton: "schedule.nav.next",
|
|
227
|
+
previousButton: "schedule.nav.previous",
|
|
228
|
+
root: "custom-root",
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|