@terreno/ui 57.20.0 → 57.22.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/CHANGELOG.md +81 -0
- package/dist/Common.d.ts +60 -27
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +2 -2
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +6 -6
- package/dist/DateTimeField.js.map +1 -1
- package/dist/HeightField.js +8 -8
- package/dist/HeightField.js.map +1 -1
- package/dist/OtpField.js +4 -4
- package/dist/OtpField.js.map +1 -1
- package/dist/PickerSelect.js +9 -9
- package/dist/PickerSelect.js.map +1 -1
- package/dist/TapToEdit.d.ts +1 -1
- package/dist/TapToEdit.d.ts.map +1 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TextField.js +4 -4
- package/dist/TextField.js.map +1 -1
- package/dist/Theme.d.ts.map +1 -1
- package/dist/Theme.js +16 -0
- package/dist/Theme.js.map +1 -1
- package/package.json +4 -2
- package/src/ActionSheet.test.tsx +13 -13
- package/src/AddressField.test.tsx +9 -3
- package/src/AnnouncementNavigator.test.tsx +4 -4
- package/src/Badge.test.tsx +1 -1
- package/src/Banner.test.tsx +0 -1
- package/src/Box.test.tsx +82 -74
- package/src/Button.test.tsx +11 -6
- package/src/Card.test.tsx +2 -2
- package/src/Common.ts +65 -29
- package/src/ConflictSheet.test.tsx +5 -5
- package/src/ConsentFormScreen.test.tsx +3 -1
- package/src/ConsentNavigator.test.tsx +1 -2
- package/src/CustomSelectField.test.tsx +16 -4
- package/src/DataTable.test.tsx +4 -4
- package/src/DataTable.tsx +2 -1
- package/src/DataTableVirtualizationRegression.test.tsx +1 -0
- package/src/DateTimeActionSheet.test.tsx +2 -0
- package/src/DateTimeField.test.tsx +3 -12
- package/src/DateTimeField.tsx +6 -6
- package/src/DismissButton.test.tsx +22 -4
- package/src/EmailField.test.tsx +13 -22
- package/src/EmojiSelector.test.tsx +2 -2
- package/src/ErrorBoundary.test.tsx +5 -3
- package/src/Field.test.tsx +20 -44
- package/src/GPTChat.test.tsx +24 -16
- package/src/Heading.test.tsx +1 -1
- package/src/HeightField.tsx +8 -8
- package/src/Icon.test.tsx +2 -2
- package/src/Image.test.tsx +1 -1
- package/src/Link.test.tsx +11 -4
- package/src/MarkdownView.test.tsx +1 -1
- package/src/MobileAddressAutoComplete.test.tsx +2 -1
- package/src/Modal.test.tsx +7 -2
- package/src/ModalSheet.test.tsx +5 -4
- package/src/MultiselectField.test.tsx +17 -3
- package/src/NumberField.test.tsx +14 -14
- package/src/NumberPickerActionSheet.test.tsx +1 -1
- package/src/OpenAPIContext.test.tsx +4 -4
- package/src/OpenAPIRenderRegression.test.tsx +1 -1
- package/src/OtpField.tsx +4 -4
- package/src/P0RenderRegression.test.tsx +7 -1
- package/src/P1RenderRegression.test.tsx +1 -0
- package/src/P2ButtonRenderRegression.test.tsx +1 -0
- package/src/Page.test.tsx +1 -1
- package/src/PhoneNumberField.test.tsx +14 -38
- package/src/PickerSelect.tsx +9 -9
- package/src/Popover.test.tsx +2 -2
- package/src/RadioField.test.tsx +7 -2
- package/src/SegmentedControl.test.tsx +21 -12
- package/src/SidebarNavigation.test.tsx +18 -6
- package/src/Signature.test.tsx +20 -23
- package/src/Slider.test.tsx +1 -1
- package/src/SplitPage.test.tsx +15 -5
- package/src/TapToEdit.test.tsx +38 -15
- package/src/TapToEdit.tsx +1 -1
- package/src/TerrenoFontProvider.test.tsx +1 -1
- package/src/Text.test.tsx +4 -4
- package/src/TextField.test.tsx +82 -9
- package/src/TextField.tsx +4 -4
- package/src/Theme.test.tsx +49 -0
- package/src/Theme.tsx +16 -0
- package/src/Toast.test.tsx +5 -5
- package/src/ToastNotifications.test.tsx +73 -70
- package/src/ToastNotifications.webModal.test.tsx +2 -2
- package/src/Tooltip.test.tsx +3 -3
- package/src/UnifiedAddressAutoComplete.test.tsx +1 -1
- package/src/UserInactivity.test.tsx +4 -2
- package/src/WebAddressAutocomplete.test.tsx +12 -12
- package/src/WebDropdownMenu.test.tsx +16 -15
- package/src/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/__snapshots__/DismissButton.test.tsx.snap +3 -3
- package/src/__snapshots__/Field.test.tsx.snap +4 -2
- package/src/__snapshots__/Heading.test.tsx.snap +1 -1
- package/src/__snapshots__/Image.test.tsx.snap +1 -1
- package/src/__snapshots__/Page.test.tsx.snap +2 -2
- package/src/__snapshots__/Text.test.tsx.snap +1 -1
- package/src/asks/AskCard.test.tsx +16 -13
- package/src/asks/AskFiles.test.tsx +5 -1
- package/src/asks/askFileRefs.test.ts +1 -1
- package/src/asks/askSummary.test.ts +2 -2
- package/src/benchmarks/importTiming.ts +1 -1
- package/src/blocks/BlocksView.test.tsx +20 -11
- package/src/bunSetup.ts +1 -1
- package/src/dataTableFilters.test.tsx +1 -1
- package/src/isolated/ListDetailLayout.isolated.tsx +2 -4
- package/src/login/LoginScreen.test.tsx +6 -6
- package/src/security/PasswordCard.test.tsx +3 -3
- package/src/signUp/SignUpScreen.test.tsx +4 -4
- package/src/table/tableContext.test.tsx +5 -5
- package/src/test-utils.tsx +56 -1
- package/src/testing/reactDomServer.d.ts +7 -0
- package/src/useConsentForms.test.ts +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {afterAll, beforeAll, describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
import type {ErrorPageProps} from "./Common";
|
|
4
5
|
import {ErrorBoundary} from "./ErrorBoundary";
|
|
5
6
|
import {ErrorPage} from "./ErrorPage";
|
|
6
7
|
import {Text} from "./Text";
|
|
7
|
-
import {renderWithTheme} from "./test-utils";
|
|
8
|
+
import {elementProps, renderWithTheme} from "./test-utils";
|
|
8
9
|
|
|
9
10
|
describe("ErrorBoundary", () => {
|
|
10
11
|
// Suppress console.warn during tests
|
|
@@ -89,7 +90,8 @@ describe("ErrorBoundary", () => {
|
|
|
89
90
|
const renderedElement = boundary.render() as React.ReactElement;
|
|
90
91
|
|
|
91
92
|
expect(renderedElement.type).toBe(ErrorPage);
|
|
92
|
-
|
|
93
|
-
expect(
|
|
93
|
+
const pageProps = elementProps<ErrorPageProps>(renderedElement);
|
|
94
|
+
expect(pageProps.error).toBe(error);
|
|
95
|
+
expect(typeof pageProps.resetError).toBe("function");
|
|
94
96
|
});
|
|
95
97
|
});
|
package/src/Field.test.tsx
CHANGED
|
@@ -6,33 +6,23 @@ import {renderWithTheme} from "./test-utils";
|
|
|
6
6
|
|
|
7
7
|
describe("Field", () => {
|
|
8
8
|
it("renders text field by default", () => {
|
|
9
|
-
const {toJSON} = renderWithTheme(<Field
|
|
9
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} value="" />);
|
|
10
10
|
expect(toJSON()).toMatchSnapshot();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it("renders text field with type text", () => {
|
|
14
|
-
const {toJSON} = renderWithTheme(
|
|
15
|
-
<Field label="Name" onChange={() => {}} type="text" value="" />
|
|
16
|
-
);
|
|
14
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="text" value="" />);
|
|
17
15
|
expect(toJSON()).toMatchSnapshot();
|
|
18
16
|
});
|
|
19
17
|
|
|
20
18
|
it("renders password field", () => {
|
|
21
|
-
const {toJSON} = renderWithTheme(
|
|
22
|
-
<Field label="Password" onChange={() => {}} type="password" value="" />
|
|
23
|
-
);
|
|
19
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="password" value="" />);
|
|
24
20
|
expect(toJSON()).toMatchSnapshot();
|
|
25
21
|
});
|
|
26
22
|
|
|
27
23
|
it("reveals the password value from the visibility toggle", () => {
|
|
28
24
|
const {getByDisplayValue, getByTestId} = renderWithTheme(
|
|
29
|
-
<Field
|
|
30
|
-
label="Password"
|
|
31
|
-
onChange={() => {}}
|
|
32
|
-
testID="field-password"
|
|
33
|
-
type="password"
|
|
34
|
-
value="hunter2"
|
|
35
|
-
/>
|
|
25
|
+
<Field onChange={() => {}} testID="field-password" type="password" value="hunter2" />
|
|
36
26
|
);
|
|
37
27
|
|
|
38
28
|
expect(getByDisplayValue("hunter2").props.secureTextEntry).toBe(true);
|
|
@@ -42,58 +32,46 @@ describe("Field", () => {
|
|
|
42
32
|
});
|
|
43
33
|
|
|
44
34
|
it("renders email field", () => {
|
|
45
|
-
const {toJSON} = renderWithTheme(
|
|
46
|
-
<Field label="Email" onChange={() => {}} type="email" value="" />
|
|
47
|
-
);
|
|
35
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="email" value="" />);
|
|
48
36
|
expect(toJSON()).toMatchSnapshot();
|
|
49
37
|
});
|
|
50
38
|
|
|
51
39
|
it("renders url field", () => {
|
|
52
|
-
const {toJSON} = renderWithTheme(
|
|
53
|
-
<Field label="Website" onChange={() => {}} type="url" value="" />
|
|
54
|
-
);
|
|
40
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="url" value="" />);
|
|
55
41
|
expect(toJSON()).toMatchSnapshot();
|
|
56
42
|
});
|
|
57
43
|
|
|
58
44
|
it("renders number field", () => {
|
|
59
|
-
const {toJSON} = renderWithTheme(
|
|
60
|
-
<Field label="Age" onChange={() => {}} type="number" value="" />
|
|
61
|
-
);
|
|
45
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="number" value="" />);
|
|
62
46
|
expect(toJSON()).toMatchSnapshot();
|
|
63
47
|
});
|
|
64
48
|
|
|
65
49
|
it("renders textarea field", () => {
|
|
66
|
-
const {toJSON} = renderWithTheme(
|
|
67
|
-
<Field label="Description" onChange={() => {}} type="textarea" value="" />
|
|
68
|
-
);
|
|
50
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="textarea" value="" />);
|
|
69
51
|
expect(toJSON()).toMatchSnapshot();
|
|
70
52
|
});
|
|
71
53
|
|
|
72
54
|
it("renders boolean field", () => {
|
|
73
55
|
const handleChange = mock((_value: boolean) => {});
|
|
74
56
|
const {toJSON} = renderWithTheme(
|
|
75
|
-
<Field
|
|
57
|
+
<Field onChange={handleChange} type="boolean" value={false} />
|
|
76
58
|
);
|
|
77
59
|
expect(toJSON()).toMatchSnapshot();
|
|
78
60
|
});
|
|
79
61
|
|
|
80
62
|
it("renders date field", () => {
|
|
81
|
-
const {toJSON} = renderWithTheme(
|
|
82
|
-
<Field label="Birth Date" onChange={() => {}} type="date" value={null} />
|
|
83
|
-
);
|
|
63
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="date" value={undefined} />);
|
|
84
64
|
expect(toJSON()).toMatchSnapshot();
|
|
85
65
|
});
|
|
86
66
|
|
|
87
67
|
it("renders time field", () => {
|
|
88
|
-
const {toJSON} = renderWithTheme(
|
|
89
|
-
<Field label="Start Time" onChange={() => {}} type="time" value={null} />
|
|
90
|
-
);
|
|
68
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="time" value={undefined} />);
|
|
91
69
|
expect(toJSON()).toMatchSnapshot();
|
|
92
70
|
});
|
|
93
71
|
|
|
94
72
|
it("renders datetime field", () => {
|
|
95
73
|
const {toJSON} = renderWithTheme(
|
|
96
|
-
<Field
|
|
74
|
+
<Field onChange={() => {}} type="datetime" value={undefined} />
|
|
97
75
|
);
|
|
98
76
|
expect(toJSON()).toMatchSnapshot();
|
|
99
77
|
});
|
|
@@ -101,7 +79,6 @@ describe("Field", () => {
|
|
|
101
79
|
it("renders select field", () => {
|
|
102
80
|
const {toJSON} = renderWithTheme(
|
|
103
81
|
<Field
|
|
104
|
-
label="Country"
|
|
105
82
|
onChange={() => {}}
|
|
106
83
|
options={[
|
|
107
84
|
{label: "USA", value: "us"},
|
|
@@ -117,12 +94,12 @@ describe("Field", () => {
|
|
|
117
94
|
it("renders multiselect field", () => {
|
|
118
95
|
const {toJSON} = renderWithTheme(
|
|
119
96
|
<Field
|
|
120
|
-
label="Skills"
|
|
121
97
|
onChange={() => {}}
|
|
122
98
|
options={[
|
|
123
99
|
{label: "JavaScript", value: "js"},
|
|
124
100
|
{label: "Python", value: "py"},
|
|
125
101
|
]}
|
|
102
|
+
title="Skills"
|
|
126
103
|
type="multiselect"
|
|
127
104
|
value={[]}
|
|
128
105
|
/>
|
|
@@ -132,22 +109,23 @@ describe("Field", () => {
|
|
|
132
109
|
|
|
133
110
|
it("renders address field", () => {
|
|
134
111
|
const {toJSON} = renderWithTheme(
|
|
135
|
-
<Field
|
|
112
|
+
<Field
|
|
113
|
+
onChange={() => {}}
|
|
114
|
+
type="address"
|
|
115
|
+
value={{address1: "", city: "", state: "", zipcode: ""}}
|
|
116
|
+
/>
|
|
136
117
|
);
|
|
137
118
|
expect(toJSON()).toMatchSnapshot();
|
|
138
119
|
});
|
|
139
120
|
|
|
140
121
|
it("renders phoneNumber field", () => {
|
|
141
|
-
const {toJSON} = renderWithTheme(
|
|
142
|
-
<Field label="Phone" onChange={() => {}} type="phoneNumber" value="" />
|
|
143
|
-
);
|
|
122
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="phoneNumber" value="" />);
|
|
144
123
|
expect(toJSON()).toMatchSnapshot();
|
|
145
124
|
});
|
|
146
125
|
|
|
147
126
|
it("renders customSelect field", () => {
|
|
148
127
|
const {toJSON} = renderWithTheme(
|
|
149
128
|
<Field
|
|
150
|
-
label="Custom"
|
|
151
129
|
onChange={() => {}}
|
|
152
130
|
options={[
|
|
153
131
|
{label: "Option A", value: "a"},
|
|
@@ -161,9 +139,7 @@ describe("Field", () => {
|
|
|
161
139
|
});
|
|
162
140
|
|
|
163
141
|
it("renders signature field", () => {
|
|
164
|
-
const {toJSON} = renderWithTheme(
|
|
165
|
-
<Field label="Sign here" onChange={() => {}} type="signature" value="" />
|
|
166
|
-
);
|
|
142
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="signature" value="" />);
|
|
167
143
|
expect(toJSON()).toMatchSnapshot();
|
|
168
144
|
});
|
|
169
145
|
});
|
package/src/GPTChat.test.tsx
CHANGED
|
@@ -4,15 +4,22 @@ import {act, fireEvent, render, waitFor, within} from "@testing-library/react-na
|
|
|
4
4
|
import {assert} from "chai";
|
|
5
5
|
import {setImageAsync, setStringAsync} from "expo-clipboard";
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import {
|
|
8
|
+
AccessibilityInfo,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
Platform,
|
|
11
|
+
Pressable,
|
|
12
|
+
ScrollView,
|
|
13
|
+
type TextProps,
|
|
14
|
+
} from "react-native";
|
|
15
|
+
|
|
16
|
+
import type {AskSubmission, ChatAsk, ChatAskState} from "./asks/askTypes";
|
|
10
17
|
import type {SelectedFile} from "./FilePickerButton";
|
|
11
18
|
import type {GPTChatHistory, GPTChatMessage, GPTChatProps, MessageContentPart} from "./GPTChat";
|
|
12
19
|
import {GPTChat} from "./GPTChat";
|
|
13
20
|
import {Text} from "./Text";
|
|
14
21
|
import {ThemeProvider} from "./Theme";
|
|
15
|
-
import {renderWithTheme} from "./test-utils";
|
|
22
|
+
import {elementProps, findAllByHostType, renderWithTheme} from "./test-utils";
|
|
16
23
|
|
|
17
24
|
const mockedSetImageAsync = setImageAsync as unknown as ReturnType<typeof mock>;
|
|
18
25
|
const mockedSetStringAsync = setStringAsync as unknown as ReturnType<typeof mock>;
|
|
@@ -588,7 +595,7 @@ describe("GPTChat", () => {
|
|
|
588
595
|
const link = {click: () => clicked.push("click"), download: "", href: ""};
|
|
589
596
|
const appended: unknown[] = [];
|
|
590
597
|
const removed: unknown[] = [];
|
|
591
|
-
const domGlobals = globalThis as
|
|
598
|
+
const domGlobals = globalThis as unknown as {
|
|
592
599
|
document?: unknown;
|
|
593
600
|
window?: unknown;
|
|
594
601
|
};
|
|
@@ -626,7 +633,7 @@ describe("GPTChat", () => {
|
|
|
626
633
|
role: "assistant",
|
|
627
634
|
},
|
|
628
635
|
];
|
|
629
|
-
const domGlobals = globalThis as
|
|
636
|
+
const domGlobals = globalThis as unknown as {window?: unknown};
|
|
630
637
|
const originalWindow = domGlobals.window;
|
|
631
638
|
domGlobals.window = undefined;
|
|
632
639
|
|
|
@@ -1021,7 +1028,7 @@ describe("GPTChat asks", () => {
|
|
|
1021
1028
|
title: "Choose a plan",
|
|
1022
1029
|
};
|
|
1023
1030
|
|
|
1024
|
-
const planAsk = (state: Partial<
|
|
1031
|
+
const planAsk = (state: Partial<ChatAskState> & {input?: ChoiceAskInput} = {}): ChatAsk => ({
|
|
1025
1032
|
input: PLAN_INPUT,
|
|
1026
1033
|
kind: "choice",
|
|
1027
1034
|
status: "pending",
|
|
@@ -1407,8 +1414,9 @@ describe("GPTChat asks", () => {
|
|
|
1407
1414
|
|
|
1408
1415
|
rerender(chatWith({historyId: "h2", onAskSubmit, toolCallId: "call_second"}));
|
|
1409
1416
|
|
|
1410
|
-
const spinners =
|
|
1411
|
-
(
|
|
1417
|
+
const spinners = findAllByHostType(
|
|
1418
|
+
getByTestId("gpt-ask-call_second-submit"),
|
|
1419
|
+
"ActivityIndicator"
|
|
1412
1420
|
);
|
|
1413
1421
|
assert.lengthOf(spinners, 0);
|
|
1414
1422
|
assert.isFalse(isDisabled(getByTestId("gpt-ask-call_second-button-skip")));
|
|
@@ -1429,8 +1437,8 @@ describe("GPTChat asks", () => {
|
|
|
1429
1437
|
/>,
|
|
1430
1438
|
{
|
|
1431
1439
|
createNodeMock: (element) =>
|
|
1432
|
-
element.
|
|
1433
|
-
element.
|
|
1440
|
+
elementProps<TextProps>(element).accessibilityRole === "header" &&
|
|
1441
|
+
elementProps<TextProps>(element).children === PLAN_INPUT.prompt
|
|
1434
1442
|
? 42
|
|
1435
1443
|
: scrollable,
|
|
1436
1444
|
wrapper: ThemeProvider,
|
|
@@ -1480,7 +1488,7 @@ describe("GPTChat asks", () => {
|
|
|
1480
1488
|
|
|
1481
1489
|
it("leaves assistant markdown in place when uiBlocks is off", async () => {
|
|
1482
1490
|
const {queryByTestId, toJSON} = renderChat({
|
|
1483
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1491
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1484
1492
|
});
|
|
1485
1493
|
assert.isNull(queryByTestId("gpt-blocks-m1"));
|
|
1486
1494
|
await waitFor(() => {
|
|
@@ -1492,7 +1500,7 @@ describe("GPTChat asks", () => {
|
|
|
1492
1500
|
const onSubmit = mock(() => {});
|
|
1493
1501
|
const onBlockAction = mock(() => {});
|
|
1494
1502
|
const {getByText} = renderChat({
|
|
1495
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1503
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1496
1504
|
onBlockAction,
|
|
1497
1505
|
onSubmit,
|
|
1498
1506
|
uiBlocks: true,
|
|
@@ -1526,7 +1534,7 @@ describe("GPTChat asks", () => {
|
|
|
1526
1534
|
})
|
|
1527
1535
|
);
|
|
1528
1536
|
const {getByTestId, getByText, queryByText} = renderChat({
|
|
1529
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1537
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1530
1538
|
hostActions: ["export_csv"],
|
|
1531
1539
|
onBlockCallback,
|
|
1532
1540
|
uiBlocks: true,
|
|
@@ -1558,7 +1566,7 @@ describe("GPTChat asks", () => {
|
|
|
1558
1566
|
it("appends an assistant message when a callback returns text", async () => {
|
|
1559
1567
|
const onBlockCallback = mock(async () => ({text: "Export started"}));
|
|
1560
1568
|
const {getByText} = renderChat({
|
|
1561
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1569
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1562
1570
|
hostActions: ["export_csv"],
|
|
1563
1571
|
onBlockCallback,
|
|
1564
1572
|
uiBlocks: true,
|
|
@@ -1613,7 +1621,7 @@ describe("GPTChat asks", () => {
|
|
|
1613
1621
|
})
|
|
1614
1622
|
);
|
|
1615
1623
|
const props = {
|
|
1616
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1624
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1617
1625
|
histories,
|
|
1618
1626
|
hostActions: ["export_csv"],
|
|
1619
1627
|
onBlockCallback,
|
package/src/Heading.test.tsx
CHANGED
|
@@ -50,7 +50,7 @@ describe("Heading", () => {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it("applies secondary color", () => {
|
|
53
|
-
const {toJSON} = renderWithTheme(<Heading color="
|
|
53
|
+
const {toJSON} = renderWithTheme(<Heading color="secondaryDark">Secondary</Heading>);
|
|
54
54
|
expect(toJSON()).toMatchSnapshot();
|
|
55
55
|
});
|
|
56
56
|
|
package/src/HeightField.tsx
CHANGED
|
@@ -92,11 +92,11 @@ const HeightSegment: FC<HeightSegmentProps> = ({
|
|
|
92
92
|
[onChange, maxValue]
|
|
93
93
|
);
|
|
94
94
|
|
|
95
|
-
let borderColor = focused ? theme.
|
|
95
|
+
let borderColor = focused ? theme.field.borderFocus : theme.field.border;
|
|
96
96
|
if (disabled) {
|
|
97
|
-
borderColor = theme.
|
|
97
|
+
borderColor = theme.field.borderDisabled;
|
|
98
98
|
} else if (error) {
|
|
99
|
-
borderColor = theme.
|
|
99
|
+
borderColor = theme.field.borderError;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
return (
|
|
@@ -104,7 +104,7 @@ const HeightSegment: FC<HeightSegmentProps> = ({
|
|
|
104
104
|
<View
|
|
105
105
|
style={{
|
|
106
106
|
alignItems: "center",
|
|
107
|
-
backgroundColor: disabled ? theme.
|
|
107
|
+
backgroundColor: disabled ? theme.field.backgroundDisabled : theme.field.background,
|
|
108
108
|
borderColor,
|
|
109
109
|
borderRadius: 4,
|
|
110
110
|
borderWidth: focused ? 3 : 1,
|
|
@@ -244,11 +244,11 @@ export const HeightField: FC<HeightFieldProps> = ({
|
|
|
244
244
|
[]
|
|
245
245
|
);
|
|
246
246
|
|
|
247
|
-
let borderColor = theme.border
|
|
247
|
+
let borderColor = theme.field.border;
|
|
248
248
|
if (disabled) {
|
|
249
|
-
borderColor = theme.
|
|
249
|
+
borderColor = theme.field.borderDisabled;
|
|
250
250
|
} else if (errorText) {
|
|
251
|
-
borderColor = theme.
|
|
251
|
+
borderColor = theme.field.borderError;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
if (isAndroid) {
|
|
@@ -299,7 +299,7 @@ export const HeightField: FC<HeightFieldProps> = ({
|
|
|
299
299
|
<View
|
|
300
300
|
style={{
|
|
301
301
|
alignItems: "center",
|
|
302
|
-
backgroundColor: disabled ? theme.
|
|
302
|
+
backgroundColor: disabled ? theme.field.backgroundDisabled : theme.field.background,
|
|
303
303
|
borderColor,
|
|
304
304
|
borderRadius: 4,
|
|
305
305
|
borderWidth: 1,
|
package/src/Icon.test.tsx
CHANGED
|
@@ -25,7 +25,7 @@ describe("Icon", () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it("renders with different colors", () => {
|
|
28
|
-
const colors = ["primary", "
|
|
28
|
+
const colors = ["primary", "secondaryDark", "accent", "inverted", "error"] as const;
|
|
29
29
|
colors.forEach((color) => {
|
|
30
30
|
const {toJSON} = renderWithTheme(<Icon color={color} iconName="star" />);
|
|
31
31
|
expect(toJSON()).toMatchSnapshot();
|
|
@@ -53,7 +53,7 @@ describe("Icon", () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it("renders different icon names", () => {
|
|
56
|
-
const icons = ["check", "x", "star", "heart", "user", "
|
|
56
|
+
const icons = ["check", "x", "star", "heart", "user", "magnifying-glass"] as const;
|
|
57
57
|
icons.forEach((iconName) => {
|
|
58
58
|
const {toJSON} = renderWithTheme(<Icon iconName={iconName} />);
|
|
59
59
|
expect(toJSON()).toMatchSnapshot();
|
package/src/Image.test.tsx
CHANGED
|
@@ -51,7 +51,7 @@ describe("Image", () => {
|
|
|
51
51
|
|
|
52
52
|
it("renders with background color", () => {
|
|
53
53
|
const {toJSON} = renderWithTheme(
|
|
54
|
-
<Image color="
|
|
54
|
+
<Image color="secondaryDark" naturalWidth={200} src="https://example.com/image.jpg" />
|
|
55
55
|
);
|
|
56
56
|
expect(toJSON()).toMatchSnapshot();
|
|
57
57
|
});
|
package/src/Link.test.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
|
2
2
|
import {fireEvent} from "@testing-library/react-native";
|
|
3
3
|
import {Linking} from "react-native";
|
|
4
4
|
|
|
5
|
+
import type {LinkProps} from "./Common";
|
|
5
6
|
import {Link} from "./Link";
|
|
6
7
|
import {renderWithTheme} from "./test-utils";
|
|
7
8
|
|
|
@@ -39,9 +40,13 @@ describe("Link", () => {
|
|
|
39
40
|
const handleClick = mock(() => {});
|
|
40
41
|
const openURLSpy = spyOn(Linking, "openURL").mockImplementation(() => Promise.resolve(true));
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// LinkProps forbids href with onClick; untyped callers can still pass both.
|
|
44
|
+
const bothActionProps = {
|
|
45
|
+
href: "https://example.com",
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
text: "Both",
|
|
48
|
+
} as unknown as LinkProps;
|
|
49
|
+
const {getByText} = renderWithTheme(<Link {...bothActionProps} />);
|
|
45
50
|
|
|
46
51
|
fireEvent.press(getByText("Both"));
|
|
47
52
|
expect(handleClick).toHaveBeenCalled();
|
|
@@ -53,7 +58,9 @@ describe("Link", () => {
|
|
|
53
58
|
it("logs error when neither href nor onClick provided", () => {
|
|
54
59
|
const consoleErrorSpy = spyOn(console, "error").mockImplementation(() => {});
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
// LinkProps requires href or onClick; untyped callers can still omit both.
|
|
62
|
+
const noActionProps = {text: "No action"} as unknown as LinkProps;
|
|
63
|
+
renderWithTheme(<Link {...noActionProps} />);
|
|
57
64
|
|
|
58
65
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
59
66
|
"Link component requires either href or onClick prop"
|
|
@@ -251,7 +251,7 @@ describe("MarkdownView", () => {
|
|
|
251
251
|
const originalGetSize = Image.getSize;
|
|
252
252
|
Image.getSize = mock((_uri: string, success: (width: number, height: number) => void): void => {
|
|
253
253
|
success(1200, 800);
|
|
254
|
-
});
|
|
254
|
+
}) as unknown as typeof Image.getSize;
|
|
255
255
|
try {
|
|
256
256
|
const {toJSON} = renderWithTheme(
|
|
257
257
|
<MarkdownView>
|
|
@@ -3,6 +3,7 @@ import {act, fireEvent} from "@testing-library/react-native";
|
|
|
3
3
|
import {forwardRef, useImperativeHandle, useRef} from "react";
|
|
4
4
|
import {Pressable, Text, View} from "react-native";
|
|
5
5
|
|
|
6
|
+
import type {AddressInterface} from "./Common";
|
|
6
7
|
import {MobileAddressAutocomplete} from "./MobileAddressAutoComplete";
|
|
7
8
|
import {renderWithTheme} from "./test-utils";
|
|
8
9
|
|
|
@@ -119,7 +120,7 @@ describe("MobileAddressAutocomplete", () => {
|
|
|
119
120
|
});
|
|
120
121
|
|
|
121
122
|
it("invokes handleAutoCompleteChange with processed address components", () => {
|
|
122
|
-
const handleAutoCompleteChange = mock(() => {});
|
|
123
|
+
const handleAutoCompleteChange = mock((_address: AddressInterface) => {});
|
|
123
124
|
const handleAddressChange = mock(() => {});
|
|
124
125
|
setAddressTextSpy.mockClear();
|
|
125
126
|
const {getByTestId} = renderWithTheme(
|
package/src/Modal.test.tsx
CHANGED
|
@@ -3,7 +3,12 @@ import {fireEvent} from "@testing-library/react-native";
|
|
|
3
3
|
import {assert} from "chai";
|
|
4
4
|
// Import Platform the same way the source modules do (ESM named import) so the web blur effect
|
|
5
5
|
// (which reads Platform.OS directly in Modal.tsx) observes the value the test sets.
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Platform as ImportedPlatform,
|
|
8
|
+
Text as NativeText,
|
|
9
|
+
type ScaledSize,
|
|
10
|
+
useWindowDimensions,
|
|
11
|
+
} from "react-native";
|
|
7
12
|
import {Gesture} from "react-native-gesture-handler";
|
|
8
13
|
|
|
9
14
|
import {Modal} from "./Modal";
|
|
@@ -599,7 +604,7 @@ describe("Modal web platform", () => {
|
|
|
599
604
|
const handleAction = mock(() => {});
|
|
600
605
|
const {UNSAFE_getAllByType, getByText} = renderWithTheme(
|
|
601
606
|
<Modal onDismiss={handleDismiss} title="Title" visible>
|
|
602
|
-
<
|
|
607
|
+
<NativeText onPress={handleAction}>Mark read</NativeText>
|
|
603
608
|
</Modal>
|
|
604
609
|
);
|
|
605
610
|
fireEvent.press(getByText("Mark read"));
|
package/src/ModalSheet.test.tsx
CHANGED
|
@@ -14,10 +14,11 @@ const closeMock = mock(() => {});
|
|
|
14
14
|
mock.module("react-native-modalize", () => ({
|
|
15
15
|
Modalize: forwardRef<React.ElementRef<typeof View>, {children: React.ReactNode}>(
|
|
16
16
|
({children}, ref) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// The Modalize double exposes only the open/close handle ModalSheet calls.
|
|
18
|
+
useImperativeHandle(
|
|
19
|
+
ref,
|
|
20
|
+
() => ({close: closeMock, open: openMock}) as unknown as React.ElementRef<typeof View>
|
|
21
|
+
);
|
|
21
22
|
return (
|
|
22
23
|
<View ref={ref} testID="modalize">
|
|
23
24
|
{children}
|
|
@@ -13,21 +13,31 @@ describe("MultiselectField", () => {
|
|
|
13
13
|
|
|
14
14
|
it("renders correctly with default props", () => {
|
|
15
15
|
const {toJSON} = renderWithTheme(
|
|
16
|
-
<MultiselectField
|
|
16
|
+
<MultiselectField
|
|
17
|
+
onChange={() => {}}
|
|
18
|
+
options={defaultOptions}
|
|
19
|
+
title="Select items"
|
|
20
|
+
value={[]}
|
|
21
|
+
/>
|
|
17
22
|
);
|
|
18
23
|
expect(toJSON()).toMatchSnapshot();
|
|
19
24
|
});
|
|
20
25
|
|
|
21
26
|
it("renders title correctly", () => {
|
|
22
27
|
const {getByText} = renderWithTheme(
|
|
23
|
-
<MultiselectField
|
|
28
|
+
<MultiselectField
|
|
29
|
+
onChange={() => {}}
|
|
30
|
+
options={defaultOptions}
|
|
31
|
+
title="Choose options"
|
|
32
|
+
value={[]}
|
|
33
|
+
/>
|
|
24
34
|
);
|
|
25
35
|
expect(getByText("Choose options")).toBeTruthy();
|
|
26
36
|
});
|
|
27
37
|
|
|
28
38
|
it("renders all options", () => {
|
|
29
39
|
const {getByText} = renderWithTheme(
|
|
30
|
-
<MultiselectField onChange={() => {}} options={defaultOptions} title="Title" />
|
|
40
|
+
<MultiselectField onChange={() => {}} options={defaultOptions} title="Title" value={[]} />
|
|
31
41
|
);
|
|
32
42
|
expect(getByText("Option A")).toBeTruthy();
|
|
33
43
|
expect(getByText("Option B")).toBeTruthy();
|
|
@@ -98,6 +108,7 @@ describe("MultiselectField", () => {
|
|
|
98
108
|
onChange={() => {}}
|
|
99
109
|
options={defaultOptions}
|
|
100
110
|
title="Title"
|
|
111
|
+
value={[]}
|
|
101
112
|
variant="leftText"
|
|
102
113
|
/>
|
|
103
114
|
);
|
|
@@ -110,6 +121,7 @@ describe("MultiselectField", () => {
|
|
|
110
121
|
onChange={() => {}}
|
|
111
122
|
options={defaultOptions}
|
|
112
123
|
title="Title"
|
|
124
|
+
value={[]}
|
|
113
125
|
variant="rightText"
|
|
114
126
|
/>
|
|
115
127
|
);
|
|
@@ -123,6 +135,7 @@ describe("MultiselectField", () => {
|
|
|
123
135
|
onChange={() => {}}
|
|
124
136
|
options={defaultOptions}
|
|
125
137
|
title="Title"
|
|
138
|
+
value={[]}
|
|
126
139
|
/>
|
|
127
140
|
);
|
|
128
141
|
expect(getByText("Please select at least one option")).toBeTruthy();
|
|
@@ -135,6 +148,7 @@ describe("MultiselectField", () => {
|
|
|
135
148
|
onChange={() => {}}
|
|
136
149
|
options={defaultOptions}
|
|
137
150
|
title="Title"
|
|
151
|
+
value={[]}
|
|
138
152
|
/>
|
|
139
153
|
);
|
|
140
154
|
expect(getByText("Select all that apply")).toBeTruthy();
|