@jobber/components-native 0.87.1 → 0.88.1-JOB-139048-04134dd.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/src/ContentOverlay/ContentOverlay.js +2 -2
- package/dist/src/ContentOverlay/UNSAFE_WrappedModalize.js +27 -0
- package/dist/src/ContentOverlay/index.js +1 -0
- package/dist/src/utils/meta/meta.json +2 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/src/ContentOverlay/ContentOverlay.d.ts +1 -1
- package/dist/types/src/ContentOverlay/UNSAFE_WrappedModalize.d.ts +3 -0
- package/dist/types/src/ContentOverlay/index.d.ts +1 -0
- 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/ContentOverlay.test.tsx +30 -23
- package/src/ContentOverlay/ContentOverlay.tsx +4 -3
- package/src/ContentOverlay/UNSAFE_WrappedModalize.tsx +45 -0
- package/src/ContentOverlay/hooks/useKeyboardVisibility.test.ts +1 -1
- package/src/ContentOverlay/hooks/useViewLayoutHeight.test.ts +1 -1
- package/src/ContentOverlay/index.ts +1 -0
- 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
- package/src/utils/meta/meta.json +2 -1
|
@@ -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
|
});
|