@jobber/components-native 0.67.6 → 0.67.7-JOB-97720.28
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.
|
@@ -18,5 +18,9 @@ export interface IconProps {
|
|
|
18
18
|
* Sets a custom color for the icon. Can be a rgb() or hex value.
|
|
19
19
|
*/
|
|
20
20
|
readonly customColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Used to locate this view in end-to-end tests
|
|
23
|
+
*/
|
|
24
|
+
readonly testID?: string;
|
|
21
25
|
}
|
|
22
|
-
export declare function Icon({ name, color, size, customColor, }: IconProps): JSX.Element;
|
|
26
|
+
export declare function Icon({ name, color, size, customColor, testID, }: IconProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.7-JOB-97720.28+ea79a286",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"react-native-safe-area-context": "^4.5.2",
|
|
85
85
|
"react-native-svg": ">=12.0.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ea79a2864bbe8912d3b9a44f90bfb86286bfe8a2"
|
|
88
88
|
}
|
package/src/Icon/Icon.test.tsx
CHANGED
|
@@ -37,3 +37,13 @@ it("renders quote icon with themed color", () => {
|
|
|
37
37
|
const tree = render(<Icon name="quote" color="brand" />).toJSON();
|
|
38
38
|
expect(tree).toMatchSnapshot();
|
|
39
39
|
});
|
|
40
|
+
|
|
41
|
+
it("applies testID prop to svg element", () => {
|
|
42
|
+
const { getByTestId } = render(<Icon name="home" testID="home-icon" />);
|
|
43
|
+
expect(getByTestId("home-icon")).toBeDefined();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("applies name prop as testID when testID prop is not provided", () => {
|
|
47
|
+
const { getByTestId } = render(<Icon name="home" />);
|
|
48
|
+
expect(getByTestId("home")).toBeDefined();
|
|
49
|
+
});
|
package/src/Icon/Icon.tsx
CHANGED
|
@@ -32,6 +32,11 @@ export interface IconProps {
|
|
|
32
32
|
* Sets a custom color for the icon. Can be a rgb() or hex value.
|
|
33
33
|
*/
|
|
34
34
|
readonly customColor?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Used to locate this view in end-to-end tests
|
|
38
|
+
*/
|
|
39
|
+
readonly testID?: string;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
export function Icon({
|
|
@@ -39,6 +44,7 @@ export function Icon({
|
|
|
39
44
|
color,
|
|
40
45
|
size = "base",
|
|
41
46
|
customColor,
|
|
47
|
+
testID,
|
|
42
48
|
}: IconProps): JSX.Element {
|
|
43
49
|
const { svgClassNames, pathClassNames, paths, viewBox } = getIcon({
|
|
44
50
|
name,
|
|
@@ -67,7 +73,7 @@ export function Icon({
|
|
|
67
73
|
});
|
|
68
74
|
|
|
69
75
|
return (
|
|
70
|
-
<Svg style={svgStyle} testID={name} viewBox={viewBox}>
|
|
76
|
+
<Svg style={svgStyle} testID={testID || name} viewBox={viewBox}>
|
|
71
77
|
{icon}
|
|
72
78
|
</Svg>
|
|
73
79
|
);
|