@terreno/ui 0.14.1 → 0.14.2
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/ActionSheet.js +15 -27
- package/dist/ActionSheet.js.map +1 -1
- package/dist/MarkdownView.js +20 -7
- package/dist/MarkdownView.js.map +1 -1
- package/dist/useConsentHistory.d.ts +6 -1
- package/dist/useConsentHistory.js +2 -1
- package/dist/useConsentHistory.js.map +1 -1
- package/package.json +1 -1
- package/src/ActionSheet.test.tsx +554 -0
- package/src/ActionSheet.tsx +24 -37
- package/src/Banner.test.tsx +36 -1
- package/src/DataTable.test.tsx +176 -1
- package/src/DateTimeField.test.tsx +716 -2
- package/src/HeightActionSheet.test.tsx +1 -1
- package/src/HeightField.test.tsx +35 -0
- package/src/HeightFieldDesktop.test.tsx +19 -0
- package/src/MarkdownView.test.tsx +28 -0
- package/src/MarkdownView.tsx +69 -7
- package/src/MobileAddressAutoComplete.test.tsx +6 -2
- package/src/PickerSelect.test.tsx +243 -0
- package/src/SplitPage.test.tsx +299 -43
- package/src/TapToEdit.test.tsx +13 -0
- package/src/ToastNotifications.test.tsx +674 -0
- package/src/Tooltip.test.tsx +707 -1
- package/src/WebAddressAutocomplete.test.tsx +99 -0
- package/src/WebDropdownMenu.test.tsx +28 -2
- package/src/__snapshots__/Banner.test.tsx.snap +125 -0
- package/src/__snapshots__/DataTable.test.tsx.snap +366 -0
- package/src/__snapshots__/MarkdownView.test.tsx.snap +284 -74
- package/src/__snapshots__/SplitPage.test.tsx.snap +698 -46
- package/src/bunSetup.ts +0 -4
- package/src/login/LoginScreen.test.tsx +12 -0
- package/src/useConsentHistory.test.ts +20 -13
- package/src/useConsentHistory.ts +7 -2
package/src/bunSetup.ts
CHANGED
|
@@ -1189,10 +1189,6 @@ mock.module("react-native/Libraries/vendor/core/ErrorUtils", () => ({
|
|
|
1189
1189
|
},
|
|
1190
1190
|
}));
|
|
1191
1191
|
|
|
1192
|
-
mock.module("react-native/Libraries/Core/ReactNativeVersion", () => ({
|
|
1193
|
-
version: {major: 0, minor: 81, patch: 5},
|
|
1194
|
-
}));
|
|
1195
|
-
|
|
1196
1192
|
mock.module("react-native/Libraries/Core/NativeExceptionsManager", () => ({
|
|
1197
1193
|
default: null,
|
|
1198
1194
|
}));
|
|
@@ -131,6 +131,18 @@ describe("LoginScreen", () => {
|
|
|
131
131
|
expect(queryByTestId("login-screen-signup-link")).toBeNull();
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
it("calls onSubmit when submit button is pressed and fields filled", async () => {
|
|
135
|
+
const onSubmit = mock(() => Promise.resolve());
|
|
136
|
+
const {getByTestId} = renderWithTheme(
|
|
137
|
+
<LoginScreen fields={defaultFields} onSubmit={onSubmit} />
|
|
138
|
+
);
|
|
139
|
+
fireEvent.changeText(getByTestId("login-screen-email-input"), "user@test.com");
|
|
140
|
+
fireEvent.changeText(getByTestId("login-screen-password-input"), "secret123");
|
|
141
|
+
fireEvent.press(getByTestId("login-screen-submit-button"));
|
|
142
|
+
await new Promise((r) => setTimeout(r, 600));
|
|
143
|
+
expect(onSubmit).toHaveBeenCalled();
|
|
144
|
+
});
|
|
145
|
+
|
|
134
146
|
it("renders correctly with all props", () => {
|
|
135
147
|
const {toJSON} = renderWithTheme(
|
|
136
148
|
<LoginScreen
|
|
@@ -25,17 +25,22 @@ describe("useConsentHistory", () => {
|
|
|
25
25
|
refetch,
|
|
26
26
|
}));
|
|
27
27
|
const api = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
enhanceEndpoints: mock((opts: {addTagTypes: string[]}) => {
|
|
29
|
+
expect(opts.addTagTypes).toContain("MyConsents");
|
|
30
|
+
return {
|
|
31
|
+
injectEndpoints: mock((injectOpts: MockInjectOpts) => {
|
|
32
|
+
const build = {
|
|
33
|
+
query: mock((def: MockQueryDef) => {
|
|
34
|
+
// Exercise the URL builder so the closure captures `base`
|
|
35
|
+
const url = def.query();
|
|
36
|
+
expect(url).toContain("/consents/my");
|
|
37
|
+
return "my-consents-query";
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
injectOpts.endpoints(build);
|
|
41
|
+
return {useGetMyConsentsQuery};
|
|
35
42
|
}),
|
|
36
43
|
};
|
|
37
|
-
opts.endpoints(build);
|
|
38
|
-
return {useGetMyConsentsQuery};
|
|
39
44
|
}),
|
|
40
45
|
};
|
|
41
46
|
return {api, refetch};
|
|
@@ -84,10 +89,12 @@ describe("useConsentHistory", () => {
|
|
|
84
89
|
refetch,
|
|
85
90
|
}));
|
|
86
91
|
const api = {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
enhanceEndpoints: () => ({
|
|
93
|
+
injectEndpoints: () => {
|
|
94
|
+
injectCallCount += 1;
|
|
95
|
+
return {useGetMyConsentsQuery};
|
|
96
|
+
},
|
|
97
|
+
}),
|
|
91
98
|
};
|
|
92
99
|
const {rerender} = renderHook(() => useConsentHistory(api as unknown as ConsentHistoryApi));
|
|
93
100
|
rerender(undefined);
|
package/src/useConsentHistory.ts
CHANGED
|
@@ -39,13 +39,17 @@ interface ConsentHistoryEnhancedApi {
|
|
|
39
39
|
useGetMyConsentsQuery: () => ConsentHistoryHookState;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
interface
|
|
42
|
+
interface ConsentHistoryApiWithTags {
|
|
43
43
|
injectEndpoints: (options: {
|
|
44
44
|
endpoints: (build: ConsentHistoryQueryBuilder) => {getMyConsents: unknown};
|
|
45
45
|
overrideExisting: boolean;
|
|
46
46
|
}) => ConsentHistoryEnhancedApi;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
interface ConsentHistoryApi {
|
|
50
|
+
enhanceEndpoints: (options: {addTagTypes: string[]}) => ConsentHistoryApiWithTags;
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
/**
|
|
50
54
|
* Cache the enhanced api per (api, baseUrl). `injectEndpoints` logs a console
|
|
51
55
|
* error in development whenever an endpoint with the same name is re-injected
|
|
@@ -65,7 +69,8 @@ const getEnhancedApi = (api: ConsentHistoryApi, base: string): ConsentHistoryEnh
|
|
|
65
69
|
if (cached) {
|
|
66
70
|
return cached;
|
|
67
71
|
}
|
|
68
|
-
const
|
|
72
|
+
const apiWithConsentTags = api.enhanceEndpoints({addTagTypes: ["MyConsents"]});
|
|
73
|
+
const enhanced = apiWithConsentTags.injectEndpoints({
|
|
69
74
|
endpoints: (build) => ({
|
|
70
75
|
getMyConsents: build.query({
|
|
71
76
|
providesTags: ["MyConsents"],
|