@jobber/components-native 0.87.1 → 0.88.0
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/package.json +15 -16
- package/dist/src/Button/components/InternalButtonLoading/InternalButtonLoading.js +0 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/InputText/InputText.d.ts +2 -2
- package/package.json +15 -16
- package/src/AtlantisContext/AtlantisContext.test.tsx +1 -1
- package/src/AutoLink/AutoLink.test.tsx +2 -4
- package/src/Button/components/InternalButtonLoading/InternalButtonLoading.tsx +0 -1
- package/src/Checkbox/CheckboxGroup.test.tsx +2 -6
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +1 -1
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
- package/src/EmptyState/EmptyState.test.tsx +29 -42
- package/src/Form/components/FormMessage/FormMessage.test.tsx +40 -27
- package/src/Form/context/AtlantisFormContext.test.tsx +1 -1
- package/src/Form/hooks/useScrollToError/useScrollToError.test.tsx +2 -1
- package/src/FormatFile/FormatFile.test.tsx +6 -6
- package/src/Icon/__snapshots__/Icon.test.tsx.snap +7 -0
- package/src/InputFieldWrapper/components/Prefix/Prefix.test.tsx +5 -11
- package/src/InputText/InputText.tsx +2 -5
- package/src/ThumbnailList/ThumbnailList.test.tsx +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SyntheticEvent } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import type {
|
|
3
|
+
import type { FocusEvent, StyleProp, TextInputProps, TextStyle } from "react-native";
|
|
4
4
|
import { TextInput } from "react-native";
|
|
5
5
|
import type { RegisterOptions } from "react-hook-form";
|
|
6
6
|
import type { IconNames } from "@jobber/design";
|
|
@@ -65,7 +65,7 @@ export interface InputTextProps extends Pick<InputFieldWrapperProps, "toolbar" |
|
|
|
65
65
|
* Callback that is called when the text input is focused
|
|
66
66
|
* @param event
|
|
67
67
|
*/
|
|
68
|
-
readonly onFocus?: (event?:
|
|
68
|
+
readonly onFocus?: (event?: FocusEvent) => void;
|
|
69
69
|
/**
|
|
70
70
|
* Callback that is called when the text input is blurred
|
|
71
71
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"deepmerge": "^4.2.2",
|
|
45
45
|
"lodash": "^4.17.21",
|
|
46
46
|
"react-hook-form": "^7.52.0",
|
|
47
|
-
"react-intl": "^
|
|
47
|
+
"react-intl": "^7.1.11",
|
|
48
48
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
49
49
|
"react-native-modalize": "^2.0.13",
|
|
50
50
|
"react-native-portalize": "^1.0.7",
|
|
@@ -53,28 +53,27 @@
|
|
|
53
53
|
"ts-xor": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@react-native-community/datetimepicker": "^
|
|
56
|
+
"@react-native-community/datetimepicker": "^8.4.5",
|
|
57
|
+
"@react-native/babel-preset": "^0.81.1",
|
|
57
58
|
"@storybook/addon-a11y": "^9.1.2",
|
|
58
59
|
"@storybook/react": "^9.1.2",
|
|
59
60
|
"@storybook/react-native-web-vite": "^9.1.2",
|
|
60
|
-
"@testing-library/
|
|
61
|
-
"@testing-library/react-native": "^12.0.1",
|
|
61
|
+
"@testing-library/react-native": "^13.3.3",
|
|
62
62
|
"@types/lodash.chunk": "^4.2.7",
|
|
63
63
|
"@types/lodash.debounce": "^4.0.7",
|
|
64
64
|
"@types/lodash.identity": "^3.0.7",
|
|
65
|
-
"@types/react": "^18.0.28",
|
|
66
65
|
"@types/react-native-uuid": "^1.4.0",
|
|
66
|
+
"@types/react-test-renderer": "19.1.0",
|
|
67
67
|
"date-fns": "^2.30.0",
|
|
68
68
|
"date-fns-tz": "^2.0.0",
|
|
69
|
-
"
|
|
70
|
-
"react-native": "^
|
|
71
|
-
"react-native-
|
|
72
|
-
"react-native-modal-datetime-picker": "^15.0.1",
|
|
69
|
+
"react-native": "^0.81.4",
|
|
70
|
+
"react-native-gesture-handler": "^2.28.0",
|
|
71
|
+
"react-native-modal-datetime-picker": "^18.0.0",
|
|
73
72
|
"react-native-reanimated": "^3.7.1",
|
|
74
73
|
"react-native-safe-area-context": "^5.4.0",
|
|
75
74
|
"react-native-svg": "^15.1.0",
|
|
76
75
|
"react-native-web": "^0.20.0",
|
|
77
|
-
"react-test-renderer": "
|
|
76
|
+
"react-test-renderer": "19.1.0",
|
|
78
77
|
"storybook": "^9.1.2"
|
|
79
78
|
},
|
|
80
79
|
"peerDependencies": {
|
|
@@ -83,10 +82,10 @@
|
|
|
83
82
|
"@react-native-community/datetimepicker": ">=6.7.0",
|
|
84
83
|
"date-fns": "^2.30.0",
|
|
85
84
|
"date-fns-tz": "^2.0.0",
|
|
86
|
-
"react": "^18.
|
|
87
|
-
"react-intl": "^6
|
|
88
|
-
"react-native": ">=0.
|
|
89
|
-
"react-native-gesture-handler": ">=2.
|
|
85
|
+
"react": "^18 || ^19.1.0",
|
|
86
|
+
"react-intl": "^6 || ^7",
|
|
87
|
+
"react-native": ">=0.79.5",
|
|
88
|
+
"react-native-gesture-handler": ">=2.22.0",
|
|
90
89
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
91
90
|
"react-native-modal-datetime-picker": " >=13.0.0",
|
|
92
91
|
"react-native-modalize": "^2.0.13",
|
|
@@ -95,5 +94,5 @@
|
|
|
95
94
|
"react-native-safe-area-context": "^5.4.0",
|
|
96
95
|
"react-native-svg": ">=12.0.0"
|
|
97
96
|
},
|
|
98
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "a7bcbd7560c4e86f8db10dfd71b2e3ce5a4f8717"
|
|
99
98
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { renderHook } from "@testing-library/react-
|
|
4
|
+
import { renderHook } from "@testing-library/react-native";
|
|
5
5
|
import type { AtlantisContextProps } from "./AtlantisContext";
|
|
6
6
|
import {
|
|
7
7
|
AtlantisContext,
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { fireEvent, render } from "@testing-library/react-native";
|
|
3
|
+
import { Linking } from "react-native";
|
|
3
4
|
import { copyTextToClipboard } from "./clipboard";
|
|
4
5
|
import { AutoLink } from "./AutoLink";
|
|
5
6
|
|
|
6
|
-
const mockOpenUrl = jest.
|
|
7
|
-
jest.mock("react-native/Libraries/Linking/Linking", () => ({
|
|
8
|
-
openURL: mockOpenUrl,
|
|
9
|
-
}));
|
|
7
|
+
const mockOpenUrl = jest.spyOn(Linking, "openURL").mockImplementation();
|
|
10
8
|
|
|
11
9
|
jest.mock("./clipboard", () => {
|
|
12
10
|
return {
|
|
@@ -23,7 +23,6 @@ const leftOffset = -1 * offset;
|
|
|
23
23
|
|
|
24
24
|
// looks like deprecation for FlatList in reanimated is cascading down to other exports
|
|
25
25
|
// This is not createAnimatedComponent(FlatList), we are fine
|
|
26
|
-
// eslint-disable-next-line import/no-deprecated
|
|
27
26
|
const AnimatedImage = Animated.createAnimatedComponent(ImageBackground);
|
|
28
27
|
|
|
29
28
|
function InternalButtonLoadingInternal({
|
|
@@ -172,12 +172,8 @@ describe("when the parent checkbox does not have a label", () => {
|
|
|
172
172
|
it("does not render the parent checkbox", async () => {
|
|
173
173
|
const { checkboxGroup } = setup(undefined);
|
|
174
174
|
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
};
|
|
178
|
-
expect(findParentCheckbox).toThrow(
|
|
179
|
-
"Unable to find an element with accessibilityLabel: all condiments",
|
|
180
|
-
);
|
|
175
|
+
const parentCheckbox = checkboxGroup.queryByLabelText(parentCheckboxLabel);
|
|
176
|
+
expect(parentCheckbox).toBeNull();
|
|
181
177
|
});
|
|
182
178
|
});
|
|
183
179
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { act, renderHook } from "@testing-library/react-
|
|
1
|
+
import { act, renderHook } from "@testing-library/react-native";
|
|
2
2
|
import type { KeyboardEvent } from "react-native";
|
|
3
3
|
import { DeviceEventEmitter } from "react-native";
|
|
4
4
|
import { useKeyboardVisibility } from "./useKeyboardVisibility";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { fireEvent, render } from "@testing-library/react-native";
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react-native";
|
|
3
|
+
import { Path } from "react-native-svg";
|
|
3
4
|
import type { EmptyStateProps } from "./EmptyState";
|
|
4
5
|
import { EmptyState } from "./EmptyState";
|
|
5
|
-
import * as IconComponent from "../Icon/Icon";
|
|
6
6
|
|
|
7
7
|
const primaryOnPress = jest.fn();
|
|
8
8
|
const secondaryOnPress = jest.fn();
|
|
@@ -27,83 +27,70 @@ const component = (overrideProps?: Partial<EmptyStateProps>) => {
|
|
|
27
27
|
...overrideProps,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
render(<EmptyState {...props} />);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const iconSpy = jest.spyOn(IconComponent, "Icon");
|
|
34
|
-
|
|
35
|
-
afterEach(() => jest.clearAllMocks());
|
|
36
|
-
|
|
37
33
|
describe("EmptyState", () => {
|
|
38
34
|
it("renders the title", () => {
|
|
39
|
-
|
|
35
|
+
component();
|
|
40
36
|
|
|
41
|
-
expect(getByText(defaultProps.title)).toBeDefined();
|
|
37
|
+
expect(screen.getByText(defaultProps.title)).toBeDefined();
|
|
42
38
|
});
|
|
43
39
|
|
|
44
40
|
it("renders the description", () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
expect(getByText(defaultProps.description)).toBeDefined();
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("renders the icon", () => {
|
|
51
|
-
const { getByTestId } = component();
|
|
41
|
+
component();
|
|
52
42
|
|
|
53
|
-
expect(
|
|
43
|
+
expect(screen.getByText(defaultProps.description)).toBeDefined();
|
|
54
44
|
});
|
|
55
45
|
|
|
56
|
-
it("
|
|
46
|
+
it("renders the icon with default color and large size", () => {
|
|
57
47
|
component();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
const icon = screen.getByTestId(defaultProps.icon);
|
|
49
|
+
const path = icon.findByType(Path);
|
|
50
|
+
expect(path.props.fill).toBe("hsl(197, 90%, 12%)");
|
|
51
|
+
expect(icon.props.style).toEqual(
|
|
52
|
+
expect.arrayContaining([
|
|
53
|
+
expect.objectContaining({
|
|
54
|
+
width: 32,
|
|
55
|
+
height: 32,
|
|
56
|
+
}),
|
|
57
|
+
]),
|
|
66
58
|
);
|
|
67
59
|
});
|
|
68
60
|
|
|
69
|
-
it("
|
|
70
|
-
component({ iconColor: "
|
|
61
|
+
it("renders the correct icon color when specified", async () => {
|
|
62
|
+
component({ iconColor: "warning" });
|
|
71
63
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
name: "link",
|
|
76
|
-
size: "large",
|
|
77
|
-
},
|
|
78
|
-
{},
|
|
79
|
-
);
|
|
64
|
+
const icon = screen.getByTestId(defaultProps.icon);
|
|
65
|
+
const pathElement = icon.findByType(Path);
|
|
66
|
+
expect(pathElement.props.fill).toBe("hsl(51, 64%, 49%)");
|
|
80
67
|
});
|
|
81
68
|
|
|
82
69
|
it("renders the primary action and allows users to interact with it by clicking", () => {
|
|
83
|
-
|
|
70
|
+
component();
|
|
84
71
|
|
|
85
|
-
const button = getByLabelText(defaultProps.primaryAction.label);
|
|
72
|
+
const button = screen.getByLabelText(defaultProps.primaryAction.label);
|
|
86
73
|
expect(button).toBeDefined();
|
|
87
74
|
fireEvent.press(button);
|
|
88
75
|
expect(primaryOnPress).toHaveBeenCalledTimes(1);
|
|
89
76
|
});
|
|
90
77
|
|
|
91
78
|
it("renders the secondary action and allows users to interact with it by clicking", () => {
|
|
92
|
-
|
|
79
|
+
component();
|
|
93
80
|
|
|
94
|
-
const button = getByLabelText(defaultProps.secondaryAction.label);
|
|
81
|
+
const button = screen.getByLabelText(defaultProps.secondaryAction.label);
|
|
95
82
|
expect(button).toBeDefined();
|
|
96
83
|
fireEvent.press(button);
|
|
97
84
|
expect(secondaryOnPress).toHaveBeenCalledTimes(1);
|
|
98
85
|
});
|
|
99
86
|
|
|
100
87
|
it("does render buttons if neither primary nor secondary action is passed in", () => {
|
|
101
|
-
|
|
88
|
+
component({
|
|
102
89
|
description: "No buttons",
|
|
103
90
|
primaryAction: undefined,
|
|
104
91
|
secondaryAction: undefined,
|
|
105
92
|
});
|
|
106
93
|
|
|
107
|
-
expect(queryAllByRole("button")).toHaveLength(0);
|
|
94
|
+
expect(screen.queryAllByRole("button")).toHaveLength(0);
|
|
108
95
|
});
|
|
109
96
|
});
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
fireEvent,
|
|
4
|
+
render,
|
|
5
|
+
screen,
|
|
6
|
+
waitFor,
|
|
7
|
+
} from "@testing-library/react-native";
|
|
3
8
|
import { FormMessage } from ".";
|
|
4
9
|
|
|
5
10
|
describe("FormMessage", () => {
|
|
6
11
|
it("should render null when there are no message to show", () => {
|
|
7
|
-
|
|
8
|
-
expect(
|
|
12
|
+
render(<FormMessage />);
|
|
13
|
+
expect(screen.toJSON()).toMatchInlineSnapshot(`null`);
|
|
9
14
|
});
|
|
10
15
|
|
|
11
|
-
it("should show the message", () => {
|
|
12
|
-
|
|
16
|
+
it("should show the message", async () => {
|
|
17
|
+
render(<FormMessage />);
|
|
13
18
|
|
|
14
19
|
const description = "🔥";
|
|
15
20
|
FormMessage.show({ description });
|
|
16
|
-
|
|
21
|
+
await waitFor(() => {
|
|
22
|
+
expect(screen.getByText(description)).toBeDefined();
|
|
23
|
+
});
|
|
17
24
|
});
|
|
18
25
|
|
|
19
|
-
it("should close the message", () => {
|
|
20
|
-
|
|
26
|
+
it("should close the message", async () => {
|
|
27
|
+
render(<FormMessage />);
|
|
21
28
|
|
|
22
29
|
const description = "🌚";
|
|
23
30
|
FormMessage.show({ description });
|
|
24
|
-
|
|
31
|
+
await waitFor(() => {
|
|
32
|
+
expect(screen.getByText(description)).toBeDefined();
|
|
33
|
+
});
|
|
25
34
|
|
|
26
35
|
FormMessage.close();
|
|
27
|
-
|
|
36
|
+
await waitFor(() => {
|
|
37
|
+
expect(screen.queryByText(description)).toBeNull();
|
|
38
|
+
});
|
|
28
39
|
});
|
|
29
40
|
|
|
30
41
|
describe("Opening another message through a message", () => {
|
|
@@ -40,33 +51,35 @@ describe("FormMessage", () => {
|
|
|
40
51
|
},
|
|
41
52
|
});
|
|
42
53
|
|
|
43
|
-
it("should show the most recent message", () => {
|
|
44
|
-
|
|
45
|
-
<FormMessage />,
|
|
46
|
-
);
|
|
54
|
+
it("should show the most recent message", async () => {
|
|
55
|
+
render(<FormMessage />);
|
|
47
56
|
|
|
48
57
|
showMessage();
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
await waitFor(() => {
|
|
60
|
+
expect(screen.getByText(firstMessage)).toBeDefined();
|
|
61
|
+
});
|
|
62
|
+
expect(screen.queryByText(secondMessage)).toBeNull();
|
|
52
63
|
|
|
53
|
-
fireEvent.press(getByLabelText("Click me"));
|
|
64
|
+
fireEvent.press(screen.getByLabelText("Click me"));
|
|
54
65
|
|
|
55
|
-
expect(getByText(secondMessage)).toBeDefined();
|
|
56
|
-
expect(queryByText(firstMessage)).toBeNull();
|
|
66
|
+
expect(screen.getByText(secondMessage)).toBeDefined();
|
|
67
|
+
expect(screen.queryByText(firstMessage)).toBeNull();
|
|
57
68
|
});
|
|
58
69
|
|
|
59
|
-
it("should close the most recent message", () => {
|
|
60
|
-
|
|
61
|
-
<FormMessage />,
|
|
62
|
-
);
|
|
70
|
+
it("should close the most recent message", async () => {
|
|
71
|
+
render(<FormMessage />);
|
|
63
72
|
|
|
64
73
|
showMessage();
|
|
65
|
-
|
|
74
|
+
await waitFor(() => {
|
|
75
|
+
expect(screen.getByText("Click me")).toBeDefined();
|
|
76
|
+
});
|
|
77
|
+
fireEvent.press(screen.getByLabelText("Click me"));
|
|
66
78
|
FormMessage.close();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
79
|
+
await waitFor(() => {
|
|
80
|
+
expect(screen.getByText(firstMessage)).toBeDefined();
|
|
81
|
+
});
|
|
82
|
+
expect(screen.queryByText(secondMessage)).toBeNull();
|
|
70
83
|
});
|
|
71
84
|
});
|
|
72
85
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { renderHook } from "@testing-library/react-
|
|
3
|
+
import { renderHook } from "@testing-library/react-native";
|
|
4
4
|
import type { AtlantisFormContextProps } from "./types";
|
|
5
5
|
import {
|
|
6
6
|
AtlantisFormContext,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { renderHook } from "@testing-library/react-
|
|
1
|
+
import { renderHook } from "@testing-library/react-native";
|
|
2
2
|
import { useScrollToError } from "./useScrollToError";
|
|
3
3
|
|
|
4
4
|
const mockFormState = {
|
|
@@ -25,6 +25,7 @@ jest.mock("../../../ErrorMessageWrapper", () => ({
|
|
|
25
25
|
el: {
|
|
26
26
|
measure: jest.fn((_, callback) => callback()),
|
|
27
27
|
hasErrorMessage: true,
|
|
28
|
+
accessibilityFocus: jest.fn(),
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
register: jest.fn(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { RenderAPI } from "@testing-library/react-native";
|
|
3
|
-
import { fireEvent, render } from "@testing-library/react-native";
|
|
4
|
-
import { Host } from "react-native-portalize";
|
|
3
|
+
import { fireEvent, render, waitFor } from "@testing-library/react-native";
|
|
5
4
|
import { Alert } from "react-native";
|
|
5
|
+
import { Host } from "react-native-portalize";
|
|
6
6
|
import type { File } from ".";
|
|
7
7
|
import { FormatFile } from ".";
|
|
8
8
|
import {
|
|
@@ -117,12 +117,12 @@ function basicRenderTestWithValue() {
|
|
|
117
117
|
);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
it("renders ProgressBar state advancing with the upload percentage", () => {
|
|
120
|
+
it("renders ProgressBar state advancing with the upload percentage", async () => {
|
|
121
121
|
jest.useFakeTimers();
|
|
122
122
|
const { getByTestId } = renderFormatFile(file);
|
|
123
123
|
jest.advanceTimersByTime(progressBarAnimationTime);
|
|
124
|
-
const formatFileInnerProgressBar =
|
|
125
|
-
"format-file-inner-progress-bar",
|
|
124
|
+
const formatFileInnerProgressBar = await waitFor(() =>
|
|
125
|
+
getByTestId("format-file-inner-progress-bar"),
|
|
126
126
|
);
|
|
127
127
|
const innerProgressBarWidth = parseInt(
|
|
128
128
|
formatFileInnerProgressBar.props.style.width,
|
|
@@ -226,7 +226,7 @@ function basicRenderTestWithValue() {
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
it("creates a thumbnail when a media file is used", () => {
|
|
229
|
-
const expectedCalls = testId.includes("image") ?
|
|
229
|
+
const expectedCalls = testId.includes("image") ? 1 : 0;
|
|
230
230
|
expect(mockCreateThumbnail).toHaveBeenCalledTimes(expectedCalls);
|
|
231
231
|
});
|
|
232
232
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { render, renderHook } from "@testing-library/react-native";
|
|
2
|
+
import { render, renderHook, screen } from "@testing-library/react-native";
|
|
3
3
|
import type { TextStyle } from "react-native";
|
|
4
4
|
import type { ReactTestInstance } from "react-test-renderer";
|
|
5
|
+
import { Path } from "react-native-svg";
|
|
5
6
|
import type { PrefixIconProps, PrefixLabelProps } from "./Prefix";
|
|
6
7
|
import {
|
|
7
8
|
PrefixIcon,
|
|
@@ -12,9 +13,6 @@ import {
|
|
|
12
13
|
import { useTypographyStyles } from "../../../Typography";
|
|
13
14
|
import { useStyles } from "../../InputFieldWrapper.style";
|
|
14
15
|
import { tokens } from "../../../utils/design";
|
|
15
|
-
import * as IconComponent from "../../../Icon/Icon";
|
|
16
|
-
|
|
17
|
-
const iconSpy = jest.spyOn(IconComponent, "Icon");
|
|
18
16
|
|
|
19
17
|
const mockLabel = "$";
|
|
20
18
|
|
|
@@ -180,13 +178,9 @@ describe("Prefix", () => {
|
|
|
180
178
|
setupIcon({
|
|
181
179
|
disabled: true,
|
|
182
180
|
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
name: "invoice",
|
|
187
|
-
},
|
|
188
|
-
{},
|
|
189
|
-
);
|
|
181
|
+
const icon = screen.getByTestId("invoice");
|
|
182
|
+
const path = icon.findByType(Path);
|
|
183
|
+
expect(path.props.fill).toEqual(tokens["color-disabled"]);
|
|
190
184
|
});
|
|
191
185
|
});
|
|
192
186
|
|
|
@@ -8,10 +8,9 @@ import React, {
|
|
|
8
8
|
useState,
|
|
9
9
|
} from "react";
|
|
10
10
|
import type {
|
|
11
|
-
|
|
11
|
+
FocusEvent,
|
|
12
12
|
ReturnKeyTypeOptions,
|
|
13
13
|
StyleProp,
|
|
14
|
-
TextInputFocusEventData,
|
|
15
14
|
TextInputProps,
|
|
16
15
|
TextStyle,
|
|
17
16
|
} from "react-native";
|
|
@@ -113,9 +112,7 @@ export interface InputTextProps
|
|
|
113
112
|
* Callback that is called when the text input is focused
|
|
114
113
|
* @param event
|
|
115
114
|
*/
|
|
116
|
-
readonly onFocus?: (
|
|
117
|
-
event?: NativeSyntheticEvent<TextInputFocusEventData>,
|
|
118
|
-
) => void;
|
|
115
|
+
readonly onFocus?: (event?: FocusEvent) => void;
|
|
119
116
|
|
|
120
117
|
/**
|
|
121
118
|
* Callback that is called when the text input is blurred
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { fireEvent, render } from "@testing-library/react-native";
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react-native";
|
|
3
3
|
import { Host } from "react-native-portalize";
|
|
4
4
|
import { ThumbnailList } from "./ThumbnailList";
|
|
5
5
|
import type { File } from "../FormatFile/types";
|
|
@@ -61,15 +61,15 @@ beforeEach(() => {
|
|
|
61
61
|
});
|
|
62
62
|
|
|
63
63
|
it("renders a thumbnail component with attachments", () => {
|
|
64
|
-
|
|
65
|
-
expect(
|
|
64
|
+
setup(true);
|
|
65
|
+
expect(screen.toJSON()).toMatchSnapshot();
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
describe("when a an array of files is provided", () => {
|
|
69
69
|
it("calls the previewImages util on pressing a valid file", () => {
|
|
70
|
-
|
|
70
|
+
setup();
|
|
71
71
|
fireEvent.press(
|
|
72
|
-
getByLabelText(files[0].fileName ? files[0].fileName : "file"),
|
|
72
|
+
screen.getByLabelText(files[0].fileName ? files[0].fileName : "file"),
|
|
73
73
|
);
|
|
74
74
|
expect(onOpenFile).toHaveBeenCalledTimes(1);
|
|
75
75
|
});
|