@terreno/ui 0.23.0 → 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/dist/Button.js +4 -3
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +6 -1
- package/dist/Common.js.map +1 -1
- package/dist/IconButton.js +8 -4
- package/dist/IconButton.js.map +1 -1
- package/package.json +2 -2
- package/src/Button.test.tsx +31 -1
- package/src/Button.tsx +5 -4
- package/src/Common.ts +7 -1
- package/src/ErrorBoundary.test.tsx +3 -4
- package/src/IconButton.test.tsx +14 -0
- package/src/IconButton.tsx +9 -4
- 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__/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__/Modal.test.tsx.snap +3 -0
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +2 -0
- package/src/__snapshots__/Page.test.tsx.snap +1 -0
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +3 -0
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +2 -0
- package/src/testing/resolveTestId.test.ts +101 -0
package/dist/Button.js
CHANGED
|
@@ -52,7 +52,7 @@ const ButtonComponent = ({ confirmationText = "Are you sure you want to continue
|
|
|
52
52
|
bgColor = theme.surface.error;
|
|
53
53
|
}
|
|
54
54
|
else if (variant === "ghost") {
|
|
55
|
-
bgColor =
|
|
55
|
+
bgColor = "transparent";
|
|
56
56
|
textColor = theme.surface.secondaryDark;
|
|
57
57
|
}
|
|
58
58
|
return {
|
|
@@ -97,15 +97,16 @@ const ButtonComponent = ({ confirmationText = "Are you sure you want to continue
|
|
|
97
97
|
borderRadius: theme.radius.rounded,
|
|
98
98
|
borderWidth,
|
|
99
99
|
flexDirection: "column",
|
|
100
|
+
height: size === "sm" ? 28 : undefined,
|
|
100
101
|
justifyContent: "center",
|
|
101
102
|
paddingHorizontal: size === "sm" ? 16 : 20,
|
|
102
|
-
paddingVertical: 8 - (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0),
|
|
103
|
+
paddingVertical: size === "sm" ? 0 : 8 - (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0),
|
|
103
104
|
width: fullWidth ? "100%" : "auto",
|
|
104
105
|
}, testID: testID, children: [_jsxs(View, { style: { flexDirection: "row" }, children: [_jsxs(View, { style: { flexDirection: iconPosition === "left" ? "row" : "row-reverse" }, children: [Boolean(iconName) && (_jsx(View, { style: {
|
|
105
106
|
alignSelf: "center",
|
|
106
107
|
marginLeft: iconPosition === "right" ? 8 : 0,
|
|
107
108
|
marginRight: iconPosition === "left" ? 8 : 0,
|
|
108
|
-
}, children: CustomIcon ? (_jsx(CustomIcon, { color: color !== null && color !== void 0 ? color : theme.text.inverted, size: 16 })) : (_jsx(FontAwesome6, { color: color, name: iconName, size: 16, solid: true })) })), _jsx(Text, { style: { color, fontSize: size === "sm" ? 14 : 16, fontWeight: "700" }, children: text })] }), Boolean(loading) && (_jsx(Box, { marginLeft: 2, children: _jsx(ActivityIndicator, { color: color, size: "small" }) }))] }), withConfirmation && showConfirmation && (_jsx(Suspense, { fallback: null, children: _jsx(LazyModal, { onDismiss: () => setShowConfirmation(false), primaryButtonOnClick: async () => {
|
|
109
|
+
}, children: CustomIcon ? (_jsx(CustomIcon, { color: color !== null && color !== void 0 ? color : theme.text.inverted, size: size === "sm" ? 12 : 16 })) : (_jsx(FontAwesome6, { color: color, name: iconName, size: size === "sm" ? 12 : 16, solid: true })) })), _jsx(Text, { style: { color, fontSize: size === "sm" ? 14 : 16, fontWeight: "700" }, children: text })] }), Boolean(loading) && (_jsx(Box, { marginLeft: 2, children: _jsx(ActivityIndicator, { color: color, size: "small" }) }))] }), withConfirmation && showConfirmation && (_jsx(Suspense, { fallback: null, children: _jsx(LazyModal, { onDismiss: () => setShowConfirmation(false), primaryButtonOnClick: async () => {
|
|
109
110
|
await onClick();
|
|
110
111
|
setShowConfirmation(false);
|
|
111
112
|
}, primaryButtonText: "Confirm", secondaryButtonOnClick: () => setShowConfirmation(false), secondaryButtonText: "Cancel", subtitle: modalSubTitle, text: confirmationText, title: modalTitle, visible: showConfirmation }) }))] })));
|
package/dist/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,iCAAiC,CAAC;AAC3D,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAuB,IAAI,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,6EAA6E;AAC7E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,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CACvC,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,SAAS,IACR,SAAS,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAC3C,oBAAoB,EAAE,KAAK,IAAmB,EAAE;wBAC9C,MAAM,OAAO,EAAE,CAAC;wBAChB,mBAAmB,CAAC,KAAK,CAAC,CAAC;oBAC7B,CAAC,EACD,iBAAiB,EAAC,SAAS,EAC3B,sBAAsB,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACxD,mBAAmB,EAAC,QAAQ,EAC5B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,GACzB,GACO,CACZ,KACkB,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,MAAM,EAAC,WAAW,EAAE,oBAAoB,EAAE,mBAAmB,GAAG,KAAK,EAAC,GAAG,KAAK,CAAC;IAC/E,MAAM,gBAAgB,GAAG,cAAc,EAAE,IAAI,QAAQ,EAAE,CAAC;IAExD,IAAI,WAAW,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACrC,OAAO,CACL,KAAC,OAAO,IACN,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,mBAAmB,EACjC,IAAI,EAAE,WAAW,YAEjB,KAAC,eAAe,oBAAK,KAAK,EAAI,GACtB,CACX,CAAC;IACJ,CAAC;IAED,OAAO,KAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;AACxC,CAAC,CAAC"}
|
package/dist/Common.d.ts
CHANGED
|
@@ -1584,6 +1584,11 @@ export interface IconButtonProps extends WithTestID {
|
|
|
1584
1584
|
* If true, a loading spinner will be shown in the button.
|
|
1585
1585
|
*/
|
|
1586
1586
|
loading?: boolean;
|
|
1587
|
+
/**
|
|
1588
|
+
* The size of the button.
|
|
1589
|
+
* @default "default"
|
|
1590
|
+
*/
|
|
1591
|
+
size?: "default" | "sm";
|
|
1587
1592
|
/**
|
|
1588
1593
|
* The ideal position of the tooltip.
|
|
1589
1594
|
*/
|
|
@@ -1601,7 +1606,7 @@ export interface IconButtonProps extends WithTestID {
|
|
|
1601
1606
|
* The variant of the button, which determines its style.
|
|
1602
1607
|
* @default "primary"
|
|
1603
1608
|
*/
|
|
1604
|
-
variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation";
|
|
1609
|
+
variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation" | "ghost";
|
|
1605
1610
|
/**
|
|
1606
1611
|
* If true, a confirmation modal will be shown before the onClick action.
|
|
1607
1612
|
* @default false
|
package/dist/Common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AA6BA,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,EAC5B,4BAA4B,EAC5B,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,WAAW,CAAC;AA0ZnB,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;IACN,EAAE,EAAE,EAAE;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,OAAqB,EAAE,EAAE;IAClD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAmB,CAAC,GA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
|
@@ -14,7 +14,7 @@ import { isNative } from "./Utilities";
|
|
|
14
14
|
const ConfirmationModal = ({ visible, title, subtitle, text, onConfirm, onCancel, }) => {
|
|
15
15
|
return (_jsx(Modal, { onDismiss: onCancel, primaryButtonOnClick: onConfirm, primaryButtonText: "Confirm", secondaryButtonOnClick: onCancel, secondaryButtonText: "Cancel", subtitle: subtitle, title: title, visible: visible, children: _jsx(Text, { children: text }) }));
|
|
16
16
|
};
|
|
17
|
-
const IconButtonComponent = ({ accessibilityHint, accessibilityLabel, confirmationHeading = "Confirm", confirmationText = "Are you sure you want to continue?", disabled = false, iconName, indicator, indicatorText, loading: propsLoading = false, testID, variant = "primary", withConfirmation = false, tooltipText, onClick, }) => {
|
|
17
|
+
const IconButtonComponent = ({ accessibilityHint, accessibilityLabel, confirmationHeading = "Confirm", confirmationText = "Are you sure you want to continue?", disabled = false, iconName, indicator, indicatorText, loading: propsLoading = false, size = "default", testID, variant = "primary", withConfirmation = false, tooltipText, onClick, }) => {
|
|
18
18
|
const [loading, setLoading] = useState(propsLoading);
|
|
19
19
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
|
20
20
|
const { theme } = useTheme();
|
|
@@ -48,6 +48,10 @@ const IconButtonComponent = ({ accessibilityHint, accessibilityLabel, confirmati
|
|
|
48
48
|
backgroundColor = theme.text.inverted;
|
|
49
49
|
color = theme.text.error;
|
|
50
50
|
}
|
|
51
|
+
else if (variant === "ghost") {
|
|
52
|
+
backgroundColor = "transparent";
|
|
53
|
+
color = theme.surface.secondaryDark;
|
|
54
|
+
}
|
|
51
55
|
const indicatorColor = indicator ? theme.surface[indicator] : undefined;
|
|
52
56
|
return (_jsxs(Pressable, { accessibilityHint: (accessibilityHint !== null && accessibilityHint !== void 0 ? accessibilityHint : withConfirmation)
|
|
53
57
|
? `Opens a confirmation dialog to confirm ${accessLabel}`
|
|
@@ -76,10 +80,10 @@ const IconButtonComponent = ({ accessibilityHint, accessibilityLabel, confirmati
|
|
|
76
80
|
alignItems: "center",
|
|
77
81
|
backgroundColor,
|
|
78
82
|
borderRadius: theme.radius.rounded,
|
|
79
|
-
height: 32,
|
|
83
|
+
height: size === "sm" ? 28 : 32,
|
|
80
84
|
justifyContent: "center",
|
|
81
|
-
width: 32,
|
|
82
|
-
}, testID: testID, children: [loading ? (_jsx(ActivityIndicator, { color: color, size: "small" })) : CustomIcon ? (_jsx(CustomIcon, { color: color, size: variant === "navigation" ? 20 : 16 })) : (_jsx(FontAwesome6, { color: color, name: iconName, selectable: undefined, size: variant === "navigation" ? 20 : 16, solid: true })), Boolean(indicator) && (_jsx(View, { style: {
|
|
85
|
+
width: size === "sm" ? 28 : 32,
|
|
86
|
+
}, testID: testID, children: [loading ? (_jsx(ActivityIndicator, { color: color, size: "small" })) : CustomIcon ? (_jsx(CustomIcon, { color: color, size: size === "sm" ? 12 : variant === "navigation" ? 20 : 16 })) : (_jsx(FontAwesome6, { color: color, name: iconName, selectable: undefined, size: size === "sm" ? 12 : variant === "navigation" ? 20 : 16, solid: true, style: { textAlign: "center" } })), Boolean(indicator) && (_jsx(View, { style: {
|
|
83
87
|
alignItems: "center",
|
|
84
88
|
backgroundColor: indicatorColor,
|
|
85
89
|
borderRadius: 10,
|
package/dist/IconButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,iCAAiC,CAAC;AAC3D,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAU,QAAQ,EAAC,MAAM,OAAO,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAE,IAAI,IAAI,UAAU,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAGpF,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,KAAK,EAAC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,CAAC;QACrC,OAAO,CACL,KAAC,OAAO,IACN,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,mBAAmB,EACjC,IAAI,EAAE,WAAW,YAEjB,KAAC,mBAAmB,oBAAK,KAAK,EAAI,GAC1B,CACX,CAAC;IACJ,CAAC;IAED,OAAO,KAAC,mBAAmB,oBAAK,KAAK,EAAI,CAAC;AAC5C,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"react-router-dom": "^6.30.1",
|
|
97
97
|
"react-test-renderer": "19.1.0",
|
|
98
98
|
"tsc-watch": "^7.1.1",
|
|
99
|
-
"typedoc": "
|
|
99
|
+
"typedoc": "^0.28.17",
|
|
100
100
|
"typescript": "~5.9.2"
|
|
101
101
|
},
|
|
102
102
|
"files": [
|
|
@@ -137,5 +137,5 @@
|
|
|
137
137
|
"test:coverage": "TZ=America/New_York bun run ../scripts/check-coverage.ts",
|
|
138
138
|
"types": "bun typedoc"
|
|
139
139
|
},
|
|
140
|
-
"version": "0.23.
|
|
140
|
+
"version": "0.23.1"
|
|
141
141
|
}
|
package/src/Button.test.tsx
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {describe, expect, it, mock} from "bun:test";
|
|
1
|
+
import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
|
|
3
3
|
|
|
4
4
|
import {Button} from "./Button";
|
|
5
|
+
import {isMobileDevice} from "./MediaQuery";
|
|
5
6
|
import {renderWithIcons, renderWithTheme, TEST_CUSTOM_ICON_TEST_ID} from "./test-utils";
|
|
7
|
+
import * as Utilities from "./Utilities";
|
|
6
8
|
|
|
7
9
|
describe("Button", () => {
|
|
8
10
|
it("renders correctly with default props", () => {
|
|
@@ -334,4 +336,32 @@ describe("Button", () => {
|
|
|
334
336
|
const tree = renderWithTheme(<Button onClick={() => {}} size="sm" text="Small" />).toJSON();
|
|
335
337
|
expect(tree).toBeTruthy();
|
|
336
338
|
});
|
|
339
|
+
|
|
340
|
+
it("does not render tooltip wrapper when isMobileDevice is true", () => {
|
|
341
|
+
const nativeSpy = spyOn(Utilities, "isNative").mockReturnValue(false);
|
|
342
|
+
(isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => true);
|
|
343
|
+
|
|
344
|
+
const {getByText, toJSON} = renderWithTheme(
|
|
345
|
+
<Button onClick={() => {}} text="No Tooltip" tooltipText="Should not wrap" />
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
expect(getByText("No Tooltip")).toBeTruthy();
|
|
349
|
+
const tree = JSON.stringify(toJSON());
|
|
350
|
+
expect(tree).not.toContain("Should not wrap");
|
|
351
|
+
nativeSpy.mockRestore();
|
|
352
|
+
(isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it("renders tooltip wrapper when tooltipText is provided and not native", () => {
|
|
356
|
+
const nativeSpy = spyOn(Utilities, "isNative").mockReturnValue(false);
|
|
357
|
+
(isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
|
|
358
|
+
|
|
359
|
+
const {getByText} = renderWithTheme(
|
|
360
|
+
<Button onClick={() => {}} text="With Tooltip" tooltipText="Helpful tip" />
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
expect(getByText("With Tooltip")).toBeTruthy();
|
|
364
|
+
nativeSpy.mockRestore();
|
|
365
|
+
(isMobileDevice as ReturnType<typeof mock>).mockImplementation(() => false);
|
|
366
|
+
});
|
|
337
367
|
});
|
package/src/Button.tsx
CHANGED
|
@@ -81,7 +81,7 @@ const ButtonComponent: React.FC<ButtonProps> = ({
|
|
|
81
81
|
} else if (variant === "destructive") {
|
|
82
82
|
bgColor = theme.surface.error;
|
|
83
83
|
} else if (variant === "ghost") {
|
|
84
|
-
bgColor =
|
|
84
|
+
bgColor = "transparent";
|
|
85
85
|
textColor = theme.surface.secondaryDark;
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -146,9 +146,10 @@ const ButtonComponent: React.FC<ButtonProps> = ({
|
|
|
146
146
|
borderRadius: theme.radius.rounded,
|
|
147
147
|
borderWidth,
|
|
148
148
|
flexDirection: "column",
|
|
149
|
+
height: size === "sm" ? 28 : undefined,
|
|
149
150
|
justifyContent: "center",
|
|
150
151
|
paddingHorizontal: size === "sm" ? 16 : 20,
|
|
151
|
-
paddingVertical: 8 - (borderWidth ?? 0),
|
|
152
|
+
paddingVertical: size === "sm" ? 0 : 8 - (borderWidth ?? 0),
|
|
152
153
|
width: fullWidth ? "100%" : "auto",
|
|
153
154
|
}}
|
|
154
155
|
testID={testID}
|
|
@@ -164,9 +165,9 @@ const ButtonComponent: React.FC<ButtonProps> = ({
|
|
|
164
165
|
}}
|
|
165
166
|
>
|
|
166
167
|
{CustomIcon ? (
|
|
167
|
-
<CustomIcon color={color ?? theme.text.inverted} size={16} />
|
|
168
|
+
<CustomIcon color={color ?? theme.text.inverted} size={size === "sm" ? 12 : 16} />
|
|
168
169
|
) : (
|
|
169
|
-
<FontAwesome6 color={color} name={iconName} size={16} solid />
|
|
170
|
+
<FontAwesome6 color={color} name={iconName} size={size === "sm" ? 12 : 16} solid />
|
|
170
171
|
)}
|
|
171
172
|
</View>
|
|
172
173
|
)}
|
package/src/Common.ts
CHANGED
|
@@ -1937,6 +1937,12 @@ export interface IconButtonProps extends WithTestID {
|
|
|
1937
1937
|
*/
|
|
1938
1938
|
loading?: boolean;
|
|
1939
1939
|
|
|
1940
|
+
/**
|
|
1941
|
+
* The size of the button.
|
|
1942
|
+
* @default "default"
|
|
1943
|
+
*/
|
|
1944
|
+
size?: "default" | "sm";
|
|
1945
|
+
|
|
1940
1946
|
/**
|
|
1941
1947
|
* The ideal position of the tooltip.
|
|
1942
1948
|
*/
|
|
@@ -1957,7 +1963,7 @@ export interface IconButtonProps extends WithTestID {
|
|
|
1957
1963
|
* The variant of the button, which determines its style.
|
|
1958
1964
|
* @default "primary"
|
|
1959
1965
|
*/
|
|
1960
|
-
variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation";
|
|
1966
|
+
variant?: "primary" | "secondary" | "muted" | "destructive" | "navigation" | "ghost";
|
|
1961
1967
|
|
|
1962
1968
|
/**
|
|
1963
1969
|
* If true, a confirmation modal will be shown before the onClick action.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
2
1
|
import {afterAll, beforeAll, describe, expect, it, mock, spyOn} from "bun:test";
|
|
3
2
|
import React from "react";
|
|
4
3
|
|
|
@@ -54,14 +53,14 @@ describe("ErrorBoundary", () => {
|
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
it("calls onError when componentDidCatch receives an error", () => {
|
|
57
|
-
const onError = mock(() => {});
|
|
56
|
+
const onError = mock<(error: Error, stack: string) => void>(() => {});
|
|
58
57
|
const boundary = new ErrorBoundary({children: null, onError});
|
|
59
58
|
const error = new Error("caught");
|
|
60
59
|
|
|
61
60
|
boundary.componentDidCatch(error, {componentStack: "stack trace"});
|
|
62
61
|
|
|
63
62
|
expect(onError).toHaveBeenCalledTimes(1);
|
|
64
|
-
expect(
|
|
63
|
+
expect(onError.mock.calls[0]).toEqual([error, "stack trace"]);
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
it("does not throw when componentDidCatch is called without onError", () => {
|
|
@@ -78,7 +77,7 @@ describe("ErrorBoundary", () => {
|
|
|
78
77
|
boundary.resetError();
|
|
79
78
|
|
|
80
79
|
expect(setStateSpy).toHaveBeenCalledTimes(1);
|
|
81
|
-
expect(
|
|
80
|
+
expect(setStateSpy.mock.calls[0][0]).toEqual({error: undefined});
|
|
82
81
|
setStateSpy.mockRestore();
|
|
83
82
|
});
|
|
84
83
|
|
package/src/IconButton.test.tsx
CHANGED
|
@@ -143,6 +143,20 @@ describe("IconButton", () => {
|
|
|
143
143
|
expect(toJSON()).toMatchSnapshot();
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
+
it("renders ghost variant", () => {
|
|
147
|
+
const {toJSON} = renderWithTheme(
|
|
148
|
+
<IconButton accessibilityLabel="Test" iconName="check" onClick={() => {}} variant="ghost" />
|
|
149
|
+
);
|
|
150
|
+
expect(toJSON()).toMatchSnapshot();
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("renders sm size", () => {
|
|
154
|
+
const {toJSON} = renderWithTheme(
|
|
155
|
+
<IconButton accessibilityLabel="Test" iconName="check" onClick={() => {}} size="sm" />
|
|
156
|
+
);
|
|
157
|
+
expect(toJSON()).toMatchSnapshot();
|
|
158
|
+
});
|
|
159
|
+
|
|
146
160
|
describe("custom icons", () => {
|
|
147
161
|
// IconButton renders `null` under the bun/react-test-renderer harness (all of
|
|
148
162
|
// its snapshots are null), so we verify the custom-icon code path renders
|
package/src/IconButton.tsx
CHANGED
|
@@ -56,6 +56,7 @@ const IconButtonComponent: FC<IconButtonProps> = ({
|
|
|
56
56
|
indicator,
|
|
57
57
|
indicatorText,
|
|
58
58
|
loading: propsLoading = false,
|
|
59
|
+
size = "default",
|
|
59
60
|
testID,
|
|
60
61
|
variant = "primary",
|
|
61
62
|
withConfirmation = false,
|
|
@@ -93,6 +94,9 @@ const IconButtonComponent: FC<IconButtonProps> = ({
|
|
|
93
94
|
} else if (variant === "destructive") {
|
|
94
95
|
backgroundColor = theme.text.inverted;
|
|
95
96
|
color = theme.text.error;
|
|
97
|
+
} else if (variant === "ghost") {
|
|
98
|
+
backgroundColor = "transparent";
|
|
99
|
+
color = theme.surface.secondaryDark;
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
const indicatorColor = indicator ? theme.surface[indicator] : undefined;
|
|
@@ -134,23 +138,24 @@ const IconButtonComponent: FC<IconButtonProps> = ({
|
|
|
134
138
|
alignItems: "center",
|
|
135
139
|
backgroundColor,
|
|
136
140
|
borderRadius: theme.radius.rounded,
|
|
137
|
-
height: 32,
|
|
141
|
+
height: size === "sm" ? 28 : 32,
|
|
138
142
|
justifyContent: "center",
|
|
139
|
-
width: 32,
|
|
143
|
+
width: size === "sm" ? 28 : 32,
|
|
140
144
|
}}
|
|
141
145
|
testID={testID}
|
|
142
146
|
>
|
|
143
147
|
{loading ? (
|
|
144
148
|
<ActivityIndicator color={color} size="small" />
|
|
145
149
|
) : CustomIcon ? (
|
|
146
|
-
<CustomIcon color={color} size={variant === "navigation" ? 20 : 16} />
|
|
150
|
+
<CustomIcon color={color} size={size === "sm" ? 12 : variant === "navigation" ? 20 : 16} />
|
|
147
151
|
) : (
|
|
148
152
|
<FontAwesome6
|
|
149
153
|
color={color}
|
|
150
154
|
name={iconName}
|
|
151
155
|
selectable={undefined}
|
|
152
|
-
size={variant === "navigation" ? 20 : 16}
|
|
156
|
+
size={size === "sm" ? 12 : variant === "navigation" ? 20 : 16}
|
|
153
157
|
solid
|
|
158
|
+
style={{textAlign: "center"}}
|
|
154
159
|
/>
|
|
155
160
|
)}
|
|
156
161
|
{Boolean(indicator) && (
|
|
@@ -60,6 +60,7 @@ exports[`Button renders correctly with default props 1`] = `
|
|
|
60
60
|
"borderRadius": 360,
|
|
61
61
|
"borderWidth": undefined,
|
|
62
62
|
"flexDirection": "column",
|
|
63
|
+
"height": undefined,
|
|
63
64
|
"justifyContent": "center",
|
|
64
65
|
"paddingHorizontal": 20,
|
|
65
66
|
"paddingVertical": 8,
|
|
@@ -131,6 +132,7 @@ exports[`Button renders primary variant 1`] = `
|
|
|
131
132
|
"borderRadius": 360,
|
|
132
133
|
"borderWidth": undefined,
|
|
133
134
|
"flexDirection": "column",
|
|
135
|
+
"height": undefined,
|
|
134
136
|
"justifyContent": "center",
|
|
135
137
|
"paddingHorizontal": 20,
|
|
136
138
|
"paddingVertical": 8,
|
|
@@ -202,6 +204,7 @@ exports[`Button renders secondary variant 1`] = `
|
|
|
202
204
|
"borderRadius": 360,
|
|
203
205
|
"borderWidth": undefined,
|
|
204
206
|
"flexDirection": "column",
|
|
207
|
+
"height": undefined,
|
|
205
208
|
"justifyContent": "center",
|
|
206
209
|
"paddingHorizontal": 20,
|
|
207
210
|
"paddingVertical": 8,
|
|
@@ -273,6 +276,7 @@ exports[`Button renders muted variant 1`] = `
|
|
|
273
276
|
"borderRadius": 360,
|
|
274
277
|
"borderWidth": undefined,
|
|
275
278
|
"flexDirection": "column",
|
|
279
|
+
"height": undefined,
|
|
276
280
|
"justifyContent": "center",
|
|
277
281
|
"paddingHorizontal": 20,
|
|
278
282
|
"paddingVertical": 8,
|
|
@@ -344,6 +348,7 @@ exports[`Button renders outline variant 1`] = `
|
|
|
344
348
|
"borderRadius": 360,
|
|
345
349
|
"borderWidth": 2,
|
|
346
350
|
"flexDirection": "column",
|
|
351
|
+
"height": undefined,
|
|
347
352
|
"justifyContent": "center",
|
|
348
353
|
"paddingHorizontal": 20,
|
|
349
354
|
"paddingVertical": 6,
|
|
@@ -415,6 +420,7 @@ exports[`Button renders destructive variant 1`] = `
|
|
|
415
420
|
"borderRadius": 360,
|
|
416
421
|
"borderWidth": undefined,
|
|
417
422
|
"flexDirection": "column",
|
|
423
|
+
"height": undefined,
|
|
418
424
|
"justifyContent": "center",
|
|
419
425
|
"paddingHorizontal": 20,
|
|
420
426
|
"paddingVertical": 8,
|
|
@@ -486,6 +492,7 @@ exports[`Button renders disabled state 1`] = `
|
|
|
486
492
|
"borderRadius": 360,
|
|
487
493
|
"borderWidth": undefined,
|
|
488
494
|
"flexDirection": "column",
|
|
495
|
+
"height": undefined,
|
|
489
496
|
"justifyContent": "center",
|
|
490
497
|
"paddingHorizontal": 20,
|
|
491
498
|
"paddingVertical": 8,
|
|
@@ -557,6 +564,7 @@ exports[`Button applies disabled styles when disabled 1`] = `
|
|
|
557
564
|
"borderRadius": 360,
|
|
558
565
|
"borderWidth": undefined,
|
|
559
566
|
"flexDirection": "column",
|
|
567
|
+
"height": undefined,
|
|
560
568
|
"justifyContent": "center",
|
|
561
569
|
"paddingHorizontal": 20,
|
|
562
570
|
"paddingVertical": 8,
|
|
@@ -651,6 +659,7 @@ exports[`Button renders loading state 1`] = `
|
|
|
651
659
|
"borderRadius": 360,
|
|
652
660
|
"borderWidth": undefined,
|
|
653
661
|
"flexDirection": "column",
|
|
662
|
+
"height": undefined,
|
|
654
663
|
"justifyContent": "center",
|
|
655
664
|
"paddingHorizontal": 20,
|
|
656
665
|
"paddingVertical": 8,
|
|
@@ -722,6 +731,7 @@ exports[`Button renders fullWidth button 1`] = `
|
|
|
722
731
|
"borderRadius": 360,
|
|
723
732
|
"borderWidth": undefined,
|
|
724
733
|
"flexDirection": "column",
|
|
734
|
+
"height": undefined,
|
|
725
735
|
"justifyContent": "center",
|
|
726
736
|
"paddingHorizontal": 20,
|
|
727
737
|
"paddingVertical": 8,
|
|
@@ -806,6 +816,7 @@ exports[`Button renders with icon on left 1`] = `
|
|
|
806
816
|
"borderRadius": 360,
|
|
807
817
|
"borderWidth": undefined,
|
|
808
818
|
"flexDirection": "column",
|
|
819
|
+
"height": undefined,
|
|
809
820
|
"justifyContent": "center",
|
|
810
821
|
"paddingHorizontal": 20,
|
|
811
822
|
"paddingVertical": 8,
|
|
@@ -890,6 +901,7 @@ exports[`Button renders with icon on right 1`] = `
|
|
|
890
901
|
"borderRadius": 360,
|
|
891
902
|
"borderWidth": undefined,
|
|
892
903
|
"flexDirection": "column",
|
|
904
|
+
"height": undefined,
|
|
893
905
|
"justifyContent": "center",
|
|
894
906
|
"paddingHorizontal": 20,
|
|
895
907
|
"paddingVertical": 8,
|
|
@@ -961,6 +973,7 @@ exports[`Button renders with confirmation modal props 1`] = `
|
|
|
961
973
|
"borderRadius": 360,
|
|
962
974
|
"borderWidth": undefined,
|
|
963
975
|
"flexDirection": "column",
|
|
976
|
+
"height": undefined,
|
|
964
977
|
"justifyContent": "center",
|
|
965
978
|
"paddingHorizontal": 20,
|
|
966
979
|
"paddingVertical": 8,
|
|
@@ -1032,6 +1045,7 @@ exports[`Button renders with tooltip on desktop (wrapped in Tooltip) 1`] = `
|
|
|
1032
1045
|
"borderRadius": 360,
|
|
1033
1046
|
"borderWidth": undefined,
|
|
1034
1047
|
"flexDirection": "column",
|
|
1048
|
+
"height": undefined,
|
|
1035
1049
|
"justifyContent": "center",
|
|
1036
1050
|
"paddingHorizontal": 20,
|
|
1037
1051
|
"paddingVertical": 8,
|
|
@@ -1103,6 +1117,7 @@ exports[`Button renders with custom confirmationText and modalSubTitle 1`] = `
|
|
|
1103
1117
|
"borderRadius": 360,
|
|
1104
1118
|
"borderWidth": undefined,
|
|
1105
1119
|
"flexDirection": "column",
|
|
1120
|
+
"height": undefined,
|
|
1106
1121
|
"justifyContent": "center",
|
|
1107
1122
|
"paddingHorizontal": 20,
|
|
1108
1123
|
"paddingVertical": 8,
|
|
@@ -1197,6 +1212,7 @@ exports[`Button shows loading indicator when loading prop is true 1`] = `
|
|
|
1197
1212
|
"borderRadius": 360,
|
|
1198
1213
|
"borderWidth": undefined,
|
|
1199
1214
|
"flexDirection": "column",
|
|
1215
|
+
"height": undefined,
|
|
1200
1216
|
"justifyContent": "center",
|
|
1201
1217
|
"paddingHorizontal": 20,
|
|
1202
1218
|
"paddingVertical": 8,
|
|
@@ -1263,11 +1279,12 @@ exports[`Button renders ghost variant with correct styles 1`] = `
|
|
|
1263
1279
|
"style": {
|
|
1264
1280
|
"alignItems": "center",
|
|
1265
1281
|
"alignSelf": "flex-start",
|
|
1266
|
-
"backgroundColor": "
|
|
1282
|
+
"backgroundColor": "transparent",
|
|
1267
1283
|
"borderColor": undefined,
|
|
1268
1284
|
"borderRadius": 360,
|
|
1269
1285
|
"borderWidth": undefined,
|
|
1270
1286
|
"flexDirection": "column",
|
|
1287
|
+
"height": undefined,
|
|
1271
1288
|
"justifyContent": "center",
|
|
1272
1289
|
"paddingHorizontal": 20,
|
|
1273
1290
|
"paddingVertical": 8,
|
|
@@ -183,6 +183,7 @@ exports[`DecimalRangeActionSheet 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,
|
|
@@ -865,6 +866,7 @@ exports[`DecimalRangeActionSheet renders with different min/max range 1`] = `
|
|
|
865
866
|
"borderRadius": 360,
|
|
866
867
|
"borderWidth": undefined,
|
|
867
868
|
"flexDirection": "column",
|
|
869
|
+
"height": undefined,
|
|
868
870
|
"justifyContent": "center",
|
|
869
871
|
"paddingHorizontal": 20,
|
|
870
872
|
"paddingVertical": 8,
|
|
@@ -198,6 +198,7 @@ exports[`HeightActionSheet renders correctly 1`] = `
|
|
|
198
198
|
"borderRadius": 360,
|
|
199
199
|
"borderWidth": undefined,
|
|
200
200
|
"flexDirection": "column",
|
|
201
|
+
"height": undefined,
|
|
201
202
|
"justifyContent": "center",
|
|
202
203
|
"paddingHorizontal": 20,
|
|
203
204
|
"paddingVertical": 8,
|
|
@@ -892,6 +893,7 @@ exports[`HeightActionSheet renders with different height value 1`] = `
|
|
|
892
893
|
"borderRadius": 360,
|
|
893
894
|
"borderWidth": undefined,
|
|
894
895
|
"flexDirection": "column",
|
|
896
|
+
"height": undefined,
|
|
895
897
|
"justifyContent": "center",
|
|
896
898
|
"paddingHorizontal": 20,
|
|
897
899
|
"paddingVertical": 8,
|
|
@@ -259,6 +259,7 @@ exports[`HeightField snapshots should match snapshot with default props 1`] = `
|
|
|
259
259
|
"borderRadius": 360,
|
|
260
260
|
"borderWidth": undefined,
|
|
261
261
|
"flexDirection": "column",
|
|
262
|
+
"height": undefined,
|
|
262
263
|
"justifyContent": "center",
|
|
263
264
|
"paddingHorizontal": 20,
|
|
264
265
|
"paddingVertical": 8,
|
|
@@ -1024,6 +1025,7 @@ exports[`HeightField snapshots should match snapshot with value 1`] = `
|
|
|
1024
1025
|
"borderRadius": 360,
|
|
1025
1026
|
"borderWidth": undefined,
|
|
1026
1027
|
"flexDirection": "column",
|
|
1028
|
+
"height": undefined,
|
|
1027
1029
|
"justifyContent": "center",
|
|
1028
1030
|
"paddingHorizontal": 20,
|
|
1029
1031
|
"paddingVertical": 8,
|
|
@@ -1886,6 +1888,7 @@ exports[`HeightField snapshots should match snapshot with all props 1`] = `
|
|
|
1886
1888
|
"borderRadius": 360,
|
|
1887
1889
|
"borderWidth": undefined,
|
|
1888
1890
|
"flexDirection": "column",
|
|
1891
|
+
"height": undefined,
|
|
1889
1892
|
"justifyContent": "center",
|
|
1890
1893
|
"paddingHorizontal": 20,
|
|
1891
1894
|
"paddingVertical": 8,
|
|
@@ -2683,6 +2686,7 @@ exports[`HeightField snapshots should match snapshot when disabled 1`] = `
|
|
|
2683
2686
|
"borderRadius": 360,
|
|
2684
2687
|
"borderWidth": undefined,
|
|
2685
2688
|
"flexDirection": "column",
|
|
2689
|
+
"height": undefined,
|
|
2686
2690
|
"justifyContent": "center",
|
|
2687
2691
|
"paddingHorizontal": 20,
|
|
2688
2692
|
"paddingVertical": 8,
|
|
@@ -3519,6 +3523,7 @@ exports[`HeightField snapshots should match snapshot with error state 1`] = `
|
|
|
3519
3523
|
"borderRadius": 360,
|
|
3520
3524
|
"borderWidth": undefined,
|
|
3521
3525
|
"flexDirection": "column",
|
|
3526
|
+
"height": undefined,
|
|
3522
3527
|
"justifyContent": "center",
|
|
3523
3528
|
"paddingHorizontal": 20,
|
|
3524
3529
|
"paddingVertical": 8,
|
|
@@ -27,3 +27,7 @@ exports[`IconButton calls onClick when pressed 1`] = `null`;
|
|
|
27
27
|
exports[`IconButton has correct accessibility props 1`] = `null`;
|
|
28
28
|
|
|
29
29
|
exports[`IconButton renders with confirmation props 1`] = `null`;
|
|
30
|
+
|
|
31
|
+
exports[`IconButton renders ghost variant 1`] = `null`;
|
|
32
|
+
|
|
33
|
+
exports[`IconButton renders sm size 1`] = `null`;
|
|
@@ -182,6 +182,7 @@ exports[`InfoModalIcon renders correctly with required props 1`] = `
|
|
|
182
182
|
"borderRadius": 360,
|
|
183
183
|
"borderWidth": undefined,
|
|
184
184
|
"flexDirection": "column",
|
|
185
|
+
"height": undefined,
|
|
185
186
|
"justifyContent": "center",
|
|
186
187
|
"paddingHorizontal": 20,
|
|
187
188
|
"paddingVertical": 8,
|
|
@@ -513,6 +514,7 @@ exports[`InfoModalIcon renders with subtitle 1`] = `
|
|
|
513
514
|
"borderRadius": 360,
|
|
514
515
|
"borderWidth": undefined,
|
|
515
516
|
"flexDirection": "column",
|
|
517
|
+
"height": undefined,
|
|
516
518
|
"justifyContent": "center",
|
|
517
519
|
"paddingHorizontal": 20,
|
|
518
520
|
"paddingVertical": 8,
|
|
@@ -842,6 +844,7 @@ exports[`InfoModalIcon renders with children content 1`] = `
|
|
|
842
844
|
"borderRadius": 360,
|
|
843
845
|
"borderWidth": undefined,
|
|
844
846
|
"flexDirection": "column",
|
|
847
|
+
"height": undefined,
|
|
845
848
|
"justifyContent": "center",
|
|
846
849
|
"paddingHorizontal": 20,
|
|
847
850
|
"paddingVertical": 8,
|
|
@@ -1132,6 +1135,7 @@ exports[`InfoModalIcon opens modal when pressed 1`] = `
|
|
|
1132
1135
|
"borderRadius": 360,
|
|
1133
1136
|
"borderWidth": undefined,
|
|
1134
1137
|
"flexDirection": "column",
|
|
1138
|
+
"height": undefined,
|
|
1135
1139
|
"justifyContent": "center",
|
|
1136
1140
|
"paddingHorizontal": 20,
|
|
1137
1141
|
"paddingVertical": 8,
|
|
@@ -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,
|
|
@@ -371,6 +371,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
371
371
|
"borderRadius": 360,
|
|
372
372
|
"borderWidth": undefined,
|
|
373
373
|
"flexDirection": "column",
|
|
374
|
+
"height": undefined,
|
|
374
375
|
"justifyContent": "center",
|
|
375
376
|
"paddingHorizontal": 20,
|
|
376
377
|
"paddingVertical": 8,
|
|
@@ -453,6 +454,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
453
454
|
"borderRadius": 360,
|
|
454
455
|
"borderWidth": undefined,
|
|
455
456
|
"flexDirection": "column",
|
|
457
|
+
"height": undefined,
|
|
456
458
|
"justifyContent": "center",
|
|
457
459
|
"paddingHorizontal": 20,
|
|
458
460
|
"paddingVertical": 8,
|
|
@@ -536,6 +538,7 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
536
538
|
"borderRadius": 360,
|
|
537
539
|
"borderWidth": undefined,
|
|
538
540
|
"flexDirection": "column",
|
|
541
|
+
"height": undefined,
|
|
539
542
|
"justifyContent": "center",
|
|
540
543
|
"paddingHorizontal": 20,
|
|
541
544
|
"paddingVertical": 8,
|
|
@@ -711,6 +711,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
711
711
|
"borderRadius": 360,
|
|
712
712
|
"borderWidth": undefined,
|
|
713
713
|
"flexDirection": "column",
|
|
714
|
+
"height": undefined,
|
|
714
715
|
"justifyContent": "center",
|
|
715
716
|
"paddingHorizontal": 20,
|
|
716
717
|
"paddingVertical": 8,
|
|
@@ -793,6 +794,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
793
794
|
"borderRadius": 360,
|
|
794
795
|
"borderWidth": undefined,
|
|
795
796
|
"flexDirection": "column",
|
|
797
|
+
"height": undefined,
|
|
796
798
|
"justifyContent": "center",
|
|
797
799
|
"paddingHorizontal": 20,
|
|
798
800
|
"paddingVertical": 8,
|
|
@@ -2,12 +2,17 @@ import {describe, expect, it} from "bun:test";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
resolveDataTableRowTestID,
|
|
5
|
+
resolveDataTableTestIDs,
|
|
6
|
+
resolveDataTableTestIDsFromProps,
|
|
5
7
|
resolveFieldTestIDs,
|
|
8
|
+
resolveFieldTestIDsFromProps,
|
|
6
9
|
resolveModalTestIDs,
|
|
10
|
+
resolveModalTestIDsFromProps,
|
|
7
11
|
resolveSegmentedControlTestIDs,
|
|
8
12
|
resolveSegmentedControlTestIDsFromProps,
|
|
9
13
|
resolveTestID,
|
|
10
14
|
toDomTestProps,
|
|
15
|
+
toPlatformTestProps,
|
|
11
16
|
toTestProps,
|
|
12
17
|
} from "./resolveTestId";
|
|
13
18
|
|
|
@@ -40,6 +45,21 @@ describe("toDomTestProps", () => {
|
|
|
40
45
|
it("returns data-testid for DOM elements", () => {
|
|
41
46
|
expect(toDomTestProps("submit")).toEqual({"data-testid": "submit"});
|
|
42
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
|
+
});
|
|
43
63
|
});
|
|
44
64
|
|
|
45
65
|
describe("resolveFieldTestIDs", () => {
|
|
@@ -79,11 +99,92 @@ describe("resolveModalTestIDs", () => {
|
|
|
79
99
|
});
|
|
80
100
|
});
|
|
81
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
|
+
|
|
82
179
|
describe("resolveDataTableRowTestID", () => {
|
|
83
180
|
it("appends row key to row test id base", () => {
|
|
84
181
|
expect(resolveDataTableRowTestID("users-table.row", "abc123")).toBe("users-table.row-abc123");
|
|
85
182
|
});
|
|
86
183
|
|
|
184
|
+
it("handles numeric row keys", () => {
|
|
185
|
+
expect(resolveDataTableRowTestID("table.row", 42)).toBe("table.row-42");
|
|
186
|
+
});
|
|
187
|
+
|
|
87
188
|
it("returns undefined when base is absent", () => {
|
|
88
189
|
expect(resolveDataTableRowTestID(undefined, "abc123")).toBeUndefined();
|
|
89
190
|
});
|