@terreno/ui 0.14.0 → 0.14.1

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.
Files changed (79) hide show
  1. package/dist/ActionSheet.d.ts +1 -1
  2. package/dist/ActionSheet.js +2 -2
  3. package/dist/ActionSheet.js.map +1 -1
  4. package/dist/Common.d.ts +8 -2
  5. package/dist/Common.js +4 -4
  6. package/dist/Common.js.map +1 -1
  7. package/dist/ConsentFormScreen.js +3 -3
  8. package/dist/ConsentFormScreen.js.map +1 -1
  9. package/dist/DateUtilities.d.ts +25 -25
  10. package/dist/DateUtilities.js +31 -32
  11. package/dist/DateUtilities.js.map +1 -1
  12. package/dist/MediaQuery.d.ts +4 -4
  13. package/dist/MediaQuery.js +8 -8
  14. package/dist/MediaQuery.js.map +1 -1
  15. package/dist/Page.d.ts +1 -0
  16. package/dist/Page.js +6 -2
  17. package/dist/Page.js.map +1 -1
  18. package/dist/PickerSelect.d.ts +1 -1
  19. package/dist/PickerSelect.js +2 -2
  20. package/dist/PickerSelect.js.map +1 -1
  21. package/dist/TapToEdit.d.ts +1 -1
  22. package/dist/TapToEdit.js +2 -3
  23. package/dist/TapToEdit.js.map +1 -1
  24. package/dist/ToastNotifications.js +2 -2
  25. package/dist/ToastNotifications.js.map +1 -1
  26. package/dist/Tooltip.d.ts +24 -1
  27. package/dist/Tooltip.js +2 -2
  28. package/dist/Tooltip.js.map +1 -1
  29. package/dist/Unifier.d.ts +1 -1
  30. package/dist/Unifier.js +14 -11
  31. package/dist/Unifier.js.map +1 -1
  32. package/dist/Utilities.d.ts +8 -8
  33. package/dist/Utilities.js +12 -14
  34. package/dist/Utilities.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/signUp/PasswordRequirements.js +3 -3
  39. package/dist/signUp/PasswordRequirements.js.map +1 -1
  40. package/dist/table/TableHeaderCell.js +1 -9
  41. package/dist/table/TableHeaderCell.js.map +1 -1
  42. package/dist/table/tableContext.d.ts +1 -1
  43. package/dist/table/tableContext.js +2 -2
  44. package/dist/table/tableContext.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/ActionSheet.tsx +2 -2
  47. package/src/Banner.test.tsx +71 -0
  48. package/src/Common.ts +10 -4
  49. package/src/ConsentFormScreen.test.tsx +22 -0
  50. package/src/ConsentFormScreen.tsx +9 -3
  51. package/src/DataTable.test.tsx +217 -0
  52. package/src/DateUtilities.tsx +37 -38
  53. package/src/HeightActionSheet.test.tsx +16 -0
  54. package/src/HeightField.test.tsx +106 -1
  55. package/src/MediaQuery.ts +8 -8
  56. package/src/MobileAddressAutoComplete.test.tsx +20 -1
  57. package/src/Page.test.tsx +28 -0
  58. package/src/Page.tsx +17 -2
  59. package/src/PickerSelect.tsx +3 -3
  60. package/src/TapToEdit.test.tsx +31 -0
  61. package/src/TapToEdit.tsx +2 -3
  62. package/src/ToastNotifications.test.tsx +738 -0
  63. package/src/ToastNotifications.tsx +2 -2
  64. package/src/Tooltip.test.tsx +587 -2
  65. package/src/Tooltip.tsx +2 -2
  66. package/src/Unifier.ts +14 -11
  67. package/src/Utilities.tsx +14 -16
  68. package/src/WebAddressAutocomplete.test.tsx +138 -0
  69. package/src/WebDropdownMenu.test.tsx +23 -0
  70. package/src/index.tsx +1 -1
  71. package/src/login/LoginScreen.test.tsx +23 -1
  72. package/src/signUp/PasswordRequirements.tsx +9 -6
  73. package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +50 -2
  74. package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +25 -1
  75. package/src/table/TableHeaderCell.tsx +8 -11
  76. package/src/table/TableRow.test.tsx +31 -1
  77. package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +2 -0
  78. package/src/table/tableContext.tsx +2 -2
  79. package/src/useStoredState.test.tsx +47 -0
@@ -1,5 +1,7 @@
1
- import {describe, expect, it} from "bun:test";
1
+ import {describe, expect, it, type mock} from "bun:test";
2
+ import {act} from "@testing-library/react-native";
2
3
 
4
+ import {IconButton} from "../IconButton";
3
5
  import {Text} from "../Text";
4
6
  import {renderWithTheme} from "../test-utils";
5
7
  import {Table} from "./Table";
@@ -113,4 +115,32 @@ describe("TableRow", () => {
113
115
  // Snapshot captures the blank placeholder cell for the row without drawer contents
114
116
  expect(toJSON()).toMatchSnapshot();
115
117
  });
118
+
119
+ it("toggles drawer contents when the expand button is pressed", () => {
120
+ const iconButtonMock = IconButton as unknown as ReturnType<typeof mock>;
121
+ iconButtonMock.mockClear();
122
+
123
+ const {queryByText} = renderWithTheme(
124
+ <Table columns={[100]}>
125
+ <TableHeader>
126
+ <TableHeaderCell index={0} title="Name" />
127
+ </TableHeader>
128
+ <TableRow drawerContents={<Text>Hidden content</Text>}>
129
+ <TableText value="Row" />
130
+ </TableRow>
131
+ </Table>
132
+ );
133
+
134
+ expect(queryByText("Hidden content")).toBeNull();
135
+
136
+ act(() => {
137
+ iconButtonMock.mock.calls[iconButtonMock.mock.calls.length - 1][0].onClick();
138
+ });
139
+ expect(queryByText("Hidden content")).toBeTruthy();
140
+
141
+ act(() => {
142
+ iconButtonMock.mock.calls[iconButtonMock.mock.calls.length - 1][0].onClick();
143
+ });
144
+ expect(queryByText("Hidden content")).toBeNull();
145
+ });
116
146
  });
@@ -1544,6 +1544,8 @@ exports[`TableHeaderCell renders sortable header with sort indicator when sorted
1544
1544
  "$$typeof": Symbol(react.test.json),
1545
1545
  "children": null,
1546
1546
  "props": {
1547
+ "onPointerEnter": [Function: AsyncFunction],
1548
+ "onPointerLeave": [Function: AsyncFunction],
1547
1549
  "style": {
1548
1550
  "alignItems": "center",
1549
1551
  "backgroundColor": "#0E9DCD",
@@ -45,7 +45,7 @@ export const TableContextProvider = ({
45
45
  );
46
46
  };
47
47
 
48
- export function useTableContext(): TableContextType {
48
+ export const useTableContext = (): TableContextType => {
49
49
  const {
50
50
  columns,
51
51
  hasDrawerContents,
@@ -64,4 +64,4 @@ export function useTableContext(): TableContextType {
64
64
  sortColumn,
65
65
  stickyHeader,
66
66
  };
67
- }
67
+ };
@@ -140,4 +140,51 @@ describe("useStoredState", () => {
140
140
  expect(result.current[0]).toBe("initial value");
141
141
  expect(result.current[2]).toBe(true);
142
142
  });
143
+
144
+ it("should handle the outer catch when fetchData rejects unexpectedly", async () => {
145
+ const originalConsoleError = console.error;
146
+ console.error = mock((...args: unknown[]) => {
147
+ const msg = String(args[0]);
148
+ if (msg.includes("Error reading data from AsyncStorage")) {
149
+ throw new Error("unexpected failure in error handler");
150
+ }
151
+ });
152
+
153
+ getItemMock = mock(() => Promise.reject(new Error("Storage read failure")));
154
+ Unifier.storage.getItem = getItemMock;
155
+
156
+ const {result} = renderHook(() => useStoredState("testKey", "fallback"));
157
+
158
+ await act(async () => {
159
+ await new Promise((resolve) => setTimeout(resolve, 50));
160
+ });
161
+
162
+ expect(result.current[2]).toBe(false);
163
+ console.error = originalConsoleError;
164
+ });
165
+
166
+ it("should not update state in outer catch if unmounted", async () => {
167
+ const originalConsoleError = console.error;
168
+ console.error = mock((...args: unknown[]) => {
169
+ const msg = String(args[0]);
170
+ if (msg.includes("Error reading data from AsyncStorage")) {
171
+ throw new Error("force outer catch");
172
+ }
173
+ });
174
+
175
+ getItemMock = mock(() => Promise.reject(new Error("fail")));
176
+ Unifier.storage.getItem = getItemMock;
177
+
178
+ const {result, unmount} = renderHook(() => useStoredState("testKey", "init"));
179
+
180
+ unmount();
181
+
182
+ await act(async () => {
183
+ await new Promise((resolve) => setTimeout(resolve, 50));
184
+ });
185
+
186
+ expect(result.current[0]).toBe("init");
187
+ expect(result.current[2]).toBe(true);
188
+ console.error = originalConsoleError;
189
+ });
143
190
  });