@terreno/ui 57.20.0 → 57.21.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.
Files changed (112) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/Common.d.ts +55 -27
  3. package/dist/Common.d.ts.map +1 -1
  4. package/dist/Common.js.map +1 -1
  5. package/dist/DateTimeField.js +6 -6
  6. package/dist/DateTimeField.js.map +1 -1
  7. package/dist/HeightField.js +8 -8
  8. package/dist/HeightField.js.map +1 -1
  9. package/dist/OtpField.js +4 -4
  10. package/dist/OtpField.js.map +1 -1
  11. package/dist/PickerSelect.js +9 -9
  12. package/dist/PickerSelect.js.map +1 -1
  13. package/dist/TapToEdit.d.ts +1 -1
  14. package/dist/TapToEdit.d.ts.map +1 -1
  15. package/dist/TapToEdit.js.map +1 -1
  16. package/dist/TextField.js +4 -4
  17. package/dist/TextField.js.map +1 -1
  18. package/dist/Theme.d.ts.map +1 -1
  19. package/dist/Theme.js +16 -0
  20. package/dist/Theme.js.map +1 -1
  21. package/package.json +4 -2
  22. package/src/ActionSheet.test.tsx +13 -13
  23. package/src/AddressField.test.tsx +9 -3
  24. package/src/AnnouncementNavigator.test.tsx +4 -4
  25. package/src/Badge.test.tsx +1 -1
  26. package/src/Banner.test.tsx +0 -1
  27. package/src/Box.test.tsx +82 -74
  28. package/src/Button.test.tsx +11 -6
  29. package/src/Card.test.tsx +2 -2
  30. package/src/Common.ts +60 -29
  31. package/src/ConflictSheet.test.tsx +5 -5
  32. package/src/ConsentFormScreen.test.tsx +3 -1
  33. package/src/ConsentNavigator.test.tsx +1 -2
  34. package/src/CustomSelectField.test.tsx +16 -4
  35. package/src/DataTable.test.tsx +4 -4
  36. package/src/DataTableVirtualizationRegression.test.tsx +1 -0
  37. package/src/DateTimeActionSheet.test.tsx +2 -0
  38. package/src/DateTimeField.test.tsx +3 -12
  39. package/src/DateTimeField.tsx +6 -6
  40. package/src/DismissButton.test.tsx +22 -4
  41. package/src/EmailField.test.tsx +13 -22
  42. package/src/EmojiSelector.test.tsx +2 -2
  43. package/src/ErrorBoundary.test.tsx +5 -3
  44. package/src/Field.test.tsx +20 -44
  45. package/src/GPTChat.test.tsx +24 -16
  46. package/src/Heading.test.tsx +1 -1
  47. package/src/HeightField.tsx +8 -8
  48. package/src/Icon.test.tsx +2 -2
  49. package/src/Image.test.tsx +1 -1
  50. package/src/Link.test.tsx +11 -4
  51. package/src/MarkdownView.test.tsx +1 -1
  52. package/src/MobileAddressAutoComplete.test.tsx +2 -1
  53. package/src/Modal.test.tsx +7 -2
  54. package/src/ModalSheet.test.tsx +5 -4
  55. package/src/MultiselectField.test.tsx +17 -3
  56. package/src/NumberField.test.tsx +14 -14
  57. package/src/NumberPickerActionSheet.test.tsx +1 -1
  58. package/src/OpenAPIContext.test.tsx +4 -4
  59. package/src/OpenAPIRenderRegression.test.tsx +1 -1
  60. package/src/OtpField.tsx +4 -4
  61. package/src/P0RenderRegression.test.tsx +7 -1
  62. package/src/P1RenderRegression.test.tsx +1 -0
  63. package/src/P2ButtonRenderRegression.test.tsx +1 -0
  64. package/src/Page.test.tsx +1 -1
  65. package/src/PhoneNumberField.test.tsx +14 -38
  66. package/src/PickerSelect.tsx +9 -9
  67. package/src/Popover.test.tsx +2 -2
  68. package/src/RadioField.test.tsx +7 -2
  69. package/src/SegmentedControl.test.tsx +21 -12
  70. package/src/SidebarNavigation.test.tsx +18 -6
  71. package/src/Signature.test.tsx +20 -23
  72. package/src/Slider.test.tsx +1 -1
  73. package/src/SplitPage.test.tsx +15 -5
  74. package/src/TapToEdit.test.tsx +38 -15
  75. package/src/TapToEdit.tsx +1 -1
  76. package/src/TerrenoFontProvider.test.tsx +1 -1
  77. package/src/Text.test.tsx +4 -4
  78. package/src/TextField.test.tsx +82 -9
  79. package/src/TextField.tsx +4 -4
  80. package/src/Theme.test.tsx +49 -0
  81. package/src/Theme.tsx +16 -0
  82. package/src/Toast.test.tsx +5 -5
  83. package/src/ToastNotifications.test.tsx +73 -70
  84. package/src/ToastNotifications.webModal.test.tsx +2 -2
  85. package/src/Tooltip.test.tsx +3 -3
  86. package/src/UnifiedAddressAutoComplete.test.tsx +1 -1
  87. package/src/UserInactivity.test.tsx +4 -2
  88. package/src/WebAddressAutocomplete.test.tsx +12 -12
  89. package/src/WebDropdownMenu.test.tsx +16 -15
  90. package/src/__snapshots__/Card.test.tsx.snap +1 -1
  91. package/src/__snapshots__/DismissButton.test.tsx.snap +3 -3
  92. package/src/__snapshots__/Field.test.tsx.snap +4 -2
  93. package/src/__snapshots__/Heading.test.tsx.snap +1 -1
  94. package/src/__snapshots__/Image.test.tsx.snap +1 -1
  95. package/src/__snapshots__/Page.test.tsx.snap +2 -2
  96. package/src/__snapshots__/Text.test.tsx.snap +1 -1
  97. package/src/asks/AskCard.test.tsx +16 -13
  98. package/src/asks/AskFiles.test.tsx +5 -1
  99. package/src/asks/askFileRefs.test.ts +1 -1
  100. package/src/asks/askSummary.test.ts +2 -2
  101. package/src/benchmarks/importTiming.ts +1 -1
  102. package/src/blocks/BlocksView.test.tsx +20 -11
  103. package/src/bunSetup.ts +1 -1
  104. package/src/dataTableFilters.test.tsx +1 -1
  105. package/src/isolated/ListDetailLayout.isolated.tsx +2 -4
  106. package/src/login/LoginScreen.test.tsx +6 -6
  107. package/src/security/PasswordCard.test.tsx +3 -3
  108. package/src/signUp/SignUpScreen.test.tsx +4 -4
  109. package/src/table/tableContext.test.tsx +5 -5
  110. package/src/test-utils.tsx +56 -1
  111. package/src/testing/reactDomServer.d.ts +7 -0
  112. package/src/useConsentForms.test.ts +1 -1
@@ -4,6 +4,7 @@ import {
4
4
  type EmitterSubscription,
5
5
  type GestureResponderEvent,
6
6
  Keyboard,
7
+ type KeyboardEventListener,
7
8
  PanResponder,
8
9
  type PanResponderCallbacks,
9
10
  type PanResponderGestureState,
@@ -146,9 +147,10 @@ describe("UserInactivity", () => {
146
147
  const onAction = mock((_active: boolean) => {});
147
148
  let capturedHideCallback: (() => void) | undefined;
148
149
  const addListenerSpy = spyOn(Keyboard, "addListener").mockImplementation(
149
- (event: string, callback: () => void) => {
150
+ (event: string, callback: KeyboardEventListener) => {
150
151
  if (event === "keyboardDidHide") {
151
- capturedHideCallback = callback;
152
+ // UserInactivity's keyboard handler ignores the event payload.
153
+ capturedHideCallback = callback as () => void;
152
154
  }
153
155
  return {remove: mock(() => {})} as unknown as EmitterSubscription;
154
156
  }
@@ -5,6 +5,14 @@ import type {AddressInterface} from "./Common";
5
5
  import {renderWithTheme} from "./test-utils";
6
6
  import {WebAddressAutocomplete} from "./WebAddressAutocomplete";
7
7
 
8
+ interface PlaceResult {
9
+ address_components: {
10
+ long_name: string;
11
+ short_name: string;
12
+ types: string[];
13
+ }[];
14
+ }
15
+
8
16
  describe("WebAddressAutocomplete", () => {
9
17
  const defaultProps = {
10
18
  handleAddressChange: () => {},
@@ -51,14 +59,6 @@ describe("WebAddressAutocomplete", () => {
51
59
  });
52
60
 
53
61
  describe("with Google Maps available", () => {
54
- interface PlaceResult {
55
- address_components: {
56
- long_name: string;
57
- short_name: string;
58
- types: string[];
59
- }[];
60
- }
61
-
62
62
  interface GoogleMapsWindow {
63
63
  google?: {
64
64
  maps?: {
@@ -80,7 +80,7 @@ describe("WebAddressAutocomplete", () => {
80
80
  document?: MinimalDocument;
81
81
  }
82
82
 
83
- const testGlobal = globalThis as TestGlobals;
83
+ const testGlobal = globalThis as unknown as TestGlobals;
84
84
  const originalWindow = testGlobal.window;
85
85
  const originalDocument = testGlobal.document;
86
86
 
@@ -207,7 +207,7 @@ describe("WebAddressAutocomplete", () => {
207
207
  document?: MinimalDocument;
208
208
  }
209
209
 
210
- const testGlobal = globalThis as TestGlobals;
210
+ const testGlobal = globalThis as unknown as TestGlobals;
211
211
  const originalWindow = testGlobal.window;
212
212
  const originalDocument = testGlobal.document;
213
213
 
@@ -468,7 +468,7 @@ describe("WebAddressAutocomplete", () => {
468
468
  await new Promise((resolve) => setTimeout(resolve, 0));
469
469
  });
470
470
 
471
- const win = (globalThis as Record<string, Record<string, unknown>>).window;
471
+ const win = (globalThis as unknown as Record<string, Record<string, unknown>>).window;
472
472
  expect(win.initAutocomplete).toBeDefined();
473
473
 
474
474
  unmount();
@@ -502,7 +502,7 @@ describe("WebAddressAutocomplete", () => {
502
502
  }),
503
503
  }));
504
504
 
505
- const win = (globalThis as Record<string, Record<string, unknown>>).window;
505
+ const win = (globalThis as unknown as Record<string, Record<string, unknown>>).window;
506
506
  win.google = {
507
507
  maps: {places: {Autocomplete: autocompleteConstructor}},
508
508
  };
@@ -4,11 +4,12 @@ import {assert} from "chai";
4
4
  import type {ComponentProps} from "react";
5
5
  import {Dimensions} from "react-native";
6
6
 
7
- import {renderWithTheme} from "./test-utils";
7
+ import {findAllByHostType, renderWithTheme} from "./test-utils";
8
8
  import {
9
9
  resolveDocumentBodyPortalTarget,
10
10
  scheduleAfterPaint,
11
11
  useWebDropdownAnchor,
12
+ type WebDropdownAnchor,
12
13
  WebDropdownMenu,
13
14
  } from "./WebDropdownMenu";
14
15
 
@@ -63,7 +64,7 @@ describe("WebDropdownMenu", () => {
63
64
  });
64
65
 
65
66
  it("invokes onSelect with value and index when an option is pressed", () => {
66
- const onSelect = mock(() => {});
67
+ const onSelect = mock((_value: string, _index: number) => {});
67
68
  const {getByTestId} = renderWithTheme(
68
69
  <WebDropdownMenu
69
70
  anchor={anchor}
@@ -365,7 +366,7 @@ describe("WebDropdownMenu disableSearch", () => {
365
366
  });
366
367
 
367
368
  it("reports the original index when selecting a filtered option", () => {
368
- const onSelect = mock(() => {});
369
+ const onSelect = mock((_value: string, _index: number) => {});
369
370
  const {getByTestId} = renderWithTheme(
370
371
  <WebDropdownMenu
371
372
  anchor={anchor}
@@ -469,7 +470,7 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
469
470
  keyupListeners.push(listener);
470
471
  }
471
472
  },
472
- body: body as HTMLElement,
473
+ body: body as unknown as HTMLElement,
473
474
  removeEventListener: (type: string, listener: (event: KeyboardEvent) => void) => {
474
475
  if (type === "keyup") {
475
476
  keyupListeners = keyupListeners.filter((registered) => registered !== listener);
@@ -488,7 +489,7 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
488
489
  };
489
490
 
490
491
  const dispatchEscapeKey = (): void => {
491
- const event = {key: "Escape", stopPropagation: mock(() => {})} as KeyboardEvent;
492
+ const event = {key: "Escape", stopPropagation: mock(() => {})} as unknown as KeyboardEvent;
492
493
  for (const listener of keyupListeners) {
493
494
  listener(event);
494
495
  }
@@ -542,7 +543,7 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
542
543
  expect(style.position).toBe("fixed");
543
544
  expect(style.left).toBe(anchor.x);
544
545
 
545
- const modals = root.findAll((node) => node.type === "Modal");
546
+ const modals = findAllByHostType(root, "Modal");
546
547
  expect(modals.length).toBe(0);
547
548
  } finally {
548
549
  PlatformModule.OS = savedOS;
@@ -562,7 +563,7 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
562
563
 
563
564
  assert.isOk(getByTestId("web_dropdown_menu"));
564
565
  assert.isNull(queryByTestId("web_dropdown_modal"));
565
- assert.equal(root.findAll((node) => node.type === "Modal").length, 0);
566
+ assert.equal(findAllByHostType(root, "Modal").length, 0);
566
567
  } finally {
567
568
  PlatformModule.OS = savedOS;
568
569
  restoreWebDocument();
@@ -578,7 +579,7 @@ describe("WebDropdownMenu keepTriggerFocus portal overlay", () => {
578
579
  const placeholder = getByTestId("web_dropdown_modal");
579
580
  expect(placeholder.props.visible).toBeUndefined();
580
581
 
581
- const modals = root.findAll((node) => node.type === "Modal");
582
+ const modals = findAllByHostType(root, "Modal");
582
583
  expect(modals.length).toBe(0);
583
584
  } finally {
584
585
  PlatformModule.OS = savedOS;
@@ -712,7 +713,7 @@ describe("useWebDropdownAnchor", () => {
712
713
 
713
714
  it("invokes the callback synchronously with the existing anchor when the ref is empty", () => {
714
715
  const {result} = renderHook(() => useWebDropdownAnchor());
715
- const onMeasured = mock(() => {});
716
+ const onMeasured = mock((_anchor: WebDropdownAnchor) => {});
716
717
  act(() => {
717
718
  result.current.measure(onMeasured);
718
719
  });
@@ -726,7 +727,7 @@ describe("useWebDropdownAnchor", () => {
726
727
  cb(10, 20, 100, 40);
727
728
  });
728
729
  (result.current.triggerRef as {current: unknown}).current = {measureInWindow};
729
- const onMeasured = mock(() => {});
730
+ const onMeasured = mock((_anchor: WebDropdownAnchor) => {});
730
731
  act(() => {
731
732
  result.current.measure(onMeasured);
732
733
  });
@@ -886,14 +887,14 @@ describe("WebDropdownMenu layout callbacks", () => {
886
887
  visible
887
888
  />
888
889
  );
889
- const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
890
+ const scrollView = findAllByHostType(root, "ScrollView")[0];
890
891
  expect(scrollView).toBeTruthy();
891
892
  act(() => {
892
893
  fireEvent(scrollView, "layout", {nativeEvent: {layout: {height: 200, width: 200}}});
893
894
  });
894
895
  // The list viewport height is recorded and a scroll is scheduled; the
895
896
  // component should remain mounted and functional.
896
- expect(root.findAll((node) => node.type === "ScrollView").length).toBeGreaterThan(0);
897
+ expect(findAllByHostType(root, "ScrollView").length).toBeGreaterThan(0);
897
898
  });
898
899
 
899
900
  it("records option layout and schedules a scroll for the selected option", () => {
@@ -936,7 +937,7 @@ describe("WebDropdownMenu layout callbacks", () => {
936
937
  />
937
938
  );
938
939
 
939
- const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
940
+ const scrollView = findAllByHostType(root, "ScrollView")[0];
940
941
  const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
941
942
  const scrollRef = scrollView.props.ref as {current: unknown};
942
943
  scrollRef.current = {
@@ -975,7 +976,7 @@ describe("WebDropdownMenu layout callbacks", () => {
975
976
  />
976
977
  );
977
978
 
978
- const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
979
+ const scrollView = findAllByHostType(root, "ScrollView")[0];
979
980
  const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
980
981
  const scrollRef = scrollView.props.ref as {current: unknown};
981
982
  scrollRef.current = {
@@ -1013,7 +1014,7 @@ describe("WebDropdownMenu layout callbacks", () => {
1013
1014
  />
1014
1015
  );
1015
1016
 
1016
- const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
1017
+ const scrollView = findAllByHostType(root, "ScrollView")[0];
1017
1018
  const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
1018
1019
  const scrollRef = scrollView.props.ref as {current: unknown};
1019
1020
  scrollRef.current = {
@@ -142,7 +142,7 @@ exports[`Card container variant (default) applies custom color 1`] = `
142
142
  "onPointerEnter": [Function: AsyncFunction],
143
143
  "onPointerLeave": [Function: AsyncFunction],
144
144
  "style": {
145
- "backgroundColor": undefined,
145
+ "backgroundColor": "#2B6072",
146
146
  "borderBottomColor": "#CDCDCD",
147
147
  "borderBottomWidth": 1,
148
148
  "borderRadius": undefined,
@@ -17,7 +17,7 @@ exports[`DismissButton renders correctly with default props 1`] = `
17
17
  },
18
18
  ],
19
19
  "props": {
20
- "accessibilityHint": undefined,
20
+ "accessibilityHint": "Dismisses the message",
21
21
  "aria-label": "Dismiss",
22
22
  "aria-role": "button",
23
23
  "onPress": [Function],
@@ -49,7 +49,7 @@ exports[`DismissButton renders with primary color (default) 1`] = `
49
49
  },
50
50
  ],
51
51
  "props": {
52
- "accessibilityHint": undefined,
52
+ "accessibilityHint": "Dismisses the message",
53
53
  "aria-label": "Dismiss",
54
54
  "aria-role": "button",
55
55
  "onPress": [Function],
@@ -81,7 +81,7 @@ exports[`DismissButton renders with inverted color 1`] = `
81
81
  },
82
82
  ],
83
83
  "props": {
84
- "accessibilityHint": undefined,
84
+ "accessibilityHint": "Dismisses the message",
85
85
  "aria-label": "Dismiss",
86
86
  "aria-role": "button",
87
87
  "onPress": [Function],
@@ -3607,7 +3607,9 @@ exports[`Field renders multiselect field 1`] = `
3607
3607
  "children": [
3608
3608
  {
3609
3609
  "$$typeof": Symbol(react.test.json),
3610
- "children": null,
3610
+ "children": [
3611
+ "Skills",
3612
+ ],
3611
3613
  "props": {
3612
3614
  "numberOfLines": 0,
3613
3615
  "style": {
@@ -3830,7 +3832,7 @@ exports[`Field renders multiselect field 1`] = `
3830
3832
  ],
3831
3833
  "props": {
3832
3834
  "accessibilityHint": "Contains a prompt and list of options to select",
3833
- "aria-label": undefined,
3835
+ "aria-label": "Skills",
3834
3836
  "aria-role": "combobox",
3835
3837
  "style": {
3836
3838
  "display": "flex",
@@ -163,7 +163,7 @@ exports[`Heading applies secondary color 1`] = `
163
163
  "props": {
164
164
  "numberOfLines": 0,
165
165
  "style": {
166
- "color": undefined,
166
+ "color": "#092E3A",
167
167
  "fontFamily": "heading-bold",
168
168
  "fontSize": 16,
169
169
  },
@@ -237,7 +237,7 @@ exports[`Image renders with background color 1`] = `
237
237
  "onPointerEnter": [Function: AsyncFunction],
238
238
  "onPointerLeave": [Function: AsyncFunction],
239
239
  "style": {
240
- "backgroundColor": undefined,
240
+ "backgroundColor": "#2B6072",
241
241
  },
242
242
  "testID": undefined,
243
243
  },
@@ -1405,7 +1405,7 @@ exports[`Page renders with custom color 1`] = `
1405
1405
  "onPointerLeave": [Function: AsyncFunction],
1406
1406
  "style": {
1407
1407
  "alignSelf": "center",
1408
- "backgroundColor": undefined,
1408
+ "backgroundColor": "#2B6072",
1409
1409
  "display": "flex",
1410
1410
  "flex": undefined,
1411
1411
  "flexDirection": "column",
@@ -1437,7 +1437,7 @@ exports[`Page renders with custom color 1`] = `
1437
1437
  "scrollEventThrottle": 50,
1438
1438
  "style": {
1439
1439
  "alignSelf": "center",
1440
- "backgroundColor": undefined,
1440
+ "backgroundColor": "#2B6072",
1441
1441
  "display": "flex",
1442
1442
  "flex": undefined,
1443
1443
  "flexDirection": "column",
@@ -380,7 +380,7 @@ exports[`Text renders with secondary color 1`] = `
380
380
  "numberOfLines": 0,
381
381
  "selectable": undefined,
382
382
  "style": {
383
- "color": undefined,
383
+ "color": "#092E3A",
384
384
  "fontFamily": "text-regular",
385
385
  "fontSize": 14,
386
386
  "textAlign": "left",
@@ -9,12 +9,12 @@ import {
9
9
  import {act, fireEvent, render, waitFor, within} from "@testing-library/react-native";
10
10
  import {assert} from "chai";
11
11
  import {createRef} from "react";
12
- import type {Text as NativeText} from "react-native";
12
+ import type {Text as NativeText, TextProps} from "react-native";
13
13
  import {ThemeProvider} from "../Theme";
14
14
  import {TimezonePicker} from "../TimezonePicker";
15
- import {renderWithTheme} from "../test-utils";
15
+ import {elementProps, findAllByHostType, renderWithTheme} from "../test-utils";
16
16
  import {AskCard, type AskCardProps} from "./AskCard";
17
- import type {AskSubmission, ChatAsk} from "./askTypes";
17
+ import type {AskSubmission, ChatAsk, ChatAskState} from "./askTypes";
18
18
 
19
19
  const PLAN_INPUT: ChoiceAskInput = {
20
20
  default: ["team"],
@@ -49,7 +49,7 @@ const COUNTRY_INPUT: ChoiceAskInput = {
49
49
  select: "one",
50
50
  };
51
51
 
52
- const pendingAsk = (input: ChoiceAskInput, state: Partial<ChatAsk> = {}): ChatAsk => ({
52
+ const pendingAsk = (input: ChoiceAskInput, state: Partial<ChatAskState> = {}): ChatAsk => ({
53
53
  input,
54
54
  kind: "choice",
55
55
  status: "pending",
@@ -556,7 +556,7 @@ describe("AskCard", () => {
556
556
 
557
557
  await press(getByTestId("ask-card-button-approve"));
558
558
  assert.lengthOf(
559
- getByTestId("ask-card-button-approve").findAll((node) => node.type === "ActivityIndicator"),
559
+ findAllByHostType(getByTestId("ask-card-button-approve"), "ActivityIndicator"),
560
560
  1
561
561
  );
562
562
  assert.isTrue(isDisabled(getByTestId("ask-card-button-deny")));
@@ -1010,11 +1010,12 @@ describe("AskCard", () => {
1010
1010
  assert.isNull(card.queryByText("Enter a complete time, or clear it."));
1011
1011
  assert.isNull(card.queryByText("Enter a complete date and time, or clear it."));
1012
1012
  await press(card.getByTestId("ask-card-submit"));
1013
- assert.deepInclude(
1014
- (onSubmit.mock.calls[0]?.[0]?.response as {content: {values: Record<string, unknown>}})
1015
- ?.content?.values ?? {},
1016
- {meeting: "2026-10-01T09:30:00Z", reminder: "10:30"}
1017
- );
1013
+ const response = onSubmit.mock.calls[0]?.[0]?.response;
1014
+ const values = response?.action === "accept" ? response.content.values : undefined;
1015
+ assert.deepInclude((values ?? {}) as Record<string, unknown>, {
1016
+ meeting: "2026-10-01T09:30:00Z",
1017
+ reminder: "10:30",
1018
+ });
1018
1019
  });
1019
1020
 
1020
1021
  it("keeps Submit disabled when the hour of an on-the-hour time is cleared, and keeps the time", async () => {
@@ -1244,8 +1245,9 @@ describe("AskCard", () => {
1244
1245
  const {getByTestId} = renderCard({ask: pendingAsk(PLAN_INPUT), onSubmit});
1245
1246
 
1246
1247
  await press(getByTestId("ask-card-button-option:team"));
1247
- const spinners = getByTestId("ask-card-button-option:team").findAll(
1248
- (node) => node.type === "ActivityIndicator"
1248
+ const spinners = findAllByHostType(
1249
+ getByTestId("ask-card-button-option:team"),
1250
+ "ActivityIndicator"
1249
1251
  );
1250
1252
  assert.lengthOf(spinners, 1);
1251
1253
  assert.isTrue(isDisabled(getByTestId("ask-card-button-option:team")));
@@ -1306,7 +1308,8 @@ describe("AskCard", () => {
1306
1308
  const {getByRole} = render(
1307
1309
  <AskCard ask={pendingAsk(PLAN_INPUT)} onSubmit={async () => {}} promptRef={promptRef} />,
1308
1310
  {
1309
- createNodeMock: (element) => (element.props.accessibilityRole === "header" ? prompt : null),
1311
+ createNodeMock: (element) =>
1312
+ elementProps<TextProps>(element).accessibilityRole === "header" ? prompt : null,
1310
1313
  wrapper: ThemeProvider,
1311
1314
  }
1312
1315
  );
@@ -306,7 +306,11 @@ describe("AskCard files", () => {
306
306
  assert.isNull(rendered.queryByTestId("ask-card-errors"));
307
307
  assert.isFalse(isDisabled(rendered.getByTestId("ask-card-submit")));
308
308
 
309
- const tooLarge = {...mismatch, code: "FILE_TOO_LARGE", message: "items.txt is too large."};
309
+ const tooLarge = {
310
+ ...mismatch,
311
+ code: "FILE_TOO_LARGE" as const,
312
+ message: "items.txt is too large.",
313
+ };
310
314
  rendered.rerender(<AskCard ask={ask} errors={[tooLarge]} onSubmit={onSubmit} />);
311
315
  assert.isOk(within(rendered.getByTestId("ask-card-errors")).getByText(tooLarge.message));
312
316
 
@@ -57,7 +57,7 @@ describe("askFileRefs", () => {
57
57
  });
58
58
 
59
59
  assert.equal(ref.mimeType, "text/csv");
60
- assert.isTrue(ref.url.startsWith("data:text/csv;base64,"));
60
+ assert.isTrue(ref.url?.startsWith("data:text/csv;base64,"));
61
61
  });
62
62
 
63
63
  it("reads a picked file into a data URL of its declared type, with its byte size", async () => {
@@ -3,7 +3,7 @@ import type {ChoiceAskInput, ConfirmAskInput, FormAskInput} from "@terreno/block
3
3
  import {assert} from "chai";
4
4
 
5
5
  import {askSummary} from "./askSummary";
6
- import type {ChatAsk} from "./askTypes";
6
+ import type {ChatAsk, ChatAskState} from "./askTypes";
7
7
 
8
8
  const PLAN_INPUT: ChoiceAskInput = {
9
9
  options: [
@@ -15,7 +15,7 @@ const PLAN_INPUT: ChoiceAskInput = {
15
15
  select: "one",
16
16
  };
17
17
 
18
- const planAsk = (state: Partial<ChatAsk>): ChatAsk => ({
18
+ const planAsk = (state: Partial<ChatAskState> & {input?: ChoiceAskInput}): ChatAsk => ({
19
19
  input: PLAN_INPUT,
20
20
  kind: "choice",
21
21
  status: "answered",
@@ -28,7 +28,7 @@ describe("fresh import timing", () => {
28
28
  });
29
29
  });
30
30
  `;
31
- const childEnv = {...process.env, TZ: "America/New_York"};
31
+ const childEnv: NodeJS.ProcessEnv = {...process.env, TZ: "America/New_York"};
32
32
  delete childEnv.BUN_OPTIONS;
33
33
  writeFileSync(PROBE_FILE, probeSource, "utf8");
34
34
 
@@ -1,7 +1,7 @@
1
1
  import {afterEach, describe, expect, it, jest, mock} from "bun:test";
2
2
  import {readdirSync, readFileSync} from "node:fs";
3
3
  import {join} from "node:path";
4
- import type {Block} from "@terreno/blocks";
4
+ import type {Block, BlocksDocument} from "@terreno/blocks";
5
5
  import {act, fireEvent, waitFor} from "@testing-library/react-native";
6
6
  import {setStringAsync} from "expo-clipboard";
7
7
  import {ActivityIndicator, Image as NativeImage, ScrollView, StyleSheet} from "react-native";
@@ -14,6 +14,11 @@ import {renderWithTheme} from "../test-utils";
14
14
  import {BlocksView} from "./BlocksView";
15
15
  import {renderBlock} from "./blockRenderers";
16
16
 
17
+ /** Treats a document assembled field by field, as untyped model JSON arrives, as a BlocksDocument. */
18
+ const untypedDocument = (fields: Record<string, unknown>): BlocksDocument => {
19
+ return fields as unknown as BlocksDocument;
20
+ };
21
+
17
22
  const ACTIONS = `v: 1
18
23
  datasets:
19
24
  signups:
@@ -357,8 +362,9 @@ blocks:
357
362
  data: lamb
358
363
  `;
359
364
  type StyledNode = {parent: StyledNode | null; props: {style?: unknown}};
360
- const flatStyle = (node: StyledNode): {textAlign?: string; width?: number} =>
365
+ const flatStyle = (node: StyledNode): {height?: number; textAlign?: string; width?: number} =>
361
366
  (StyleSheet.flatten(node.props.style as never) ?? {}) as {
367
+ height?: number;
362
368
  textAlign?: string;
363
369
  width?: number;
364
370
  };
@@ -771,9 +777,10 @@ blocks:
771
777
  block.type = "html";
772
778
  block.title = "Invoice preview";
773
779
  block.html = "<h1>Invoice #1042</h1>";
774
- const document: Record<string, unknown> = {};
775
- document.v = 1;
776
- document.blocks = [block];
780
+ const fields: Record<string, unknown> = {};
781
+ fields.v = 1;
782
+ fields.blocks = [block];
783
+ const document = untypedDocument(fields);
777
784
 
778
785
  const off = renderWithTheme(<BlocksView document={document} />);
779
786
  expect(off.getByText("HTML preview is turned off.")).toBeTruthy();
@@ -804,9 +811,10 @@ blocks:
804
811
  details.type = "details";
805
812
  details.title = "Invoice notes";
806
813
  details.text = "Twelve seats, billed monthly.";
807
- const document: Record<string, unknown> = {};
808
- document.v = 1;
809
- document.blocks = [callout, picture, details];
814
+ const fields: Record<string, unknown> = {};
815
+ fields.v = 1;
816
+ fields.blocks = [callout, picture, details];
817
+ const document = untypedDocument(fields);
810
818
 
811
819
  const {getByText} = renderWithTheme(<BlocksView document={document} />);
812
820
 
@@ -821,9 +829,10 @@ blocks:
821
829
  block.type = "image";
822
830
  block.alt = "Pixel";
823
831
  block.src = "https://evil.test/pixel.png";
824
- const document: Record<string, unknown> = {};
825
- document.v = 1;
826
- document.blocks = [block];
832
+ const fields: Record<string, unknown> = {};
833
+ fields.v = 1;
834
+ fields.blocks = [block];
835
+ const document = untypedDocument(fields);
827
836
 
828
837
  const blocked = renderWithTheme(<BlocksView document={document} />);
829
838
  expect(blocked.getByText(/IMAGE_HOST_NOT_ALLOWED|allowed host/)).toBeTruthy();
package/src/bunSetup.ts CHANGED
@@ -158,7 +158,7 @@ const createSimpleFlatList = () => {
158
158
  const createVirtualizedFlatList = (): React.ForwardRefExoticComponent<
159
159
  MockFlatListProps & React.RefAttributes<unknown>
160
160
  > =>
161
- React.forwardRef((props, ref) => {
161
+ React.forwardRef((props: MockFlatListProps, ref) => {
162
162
  const {
163
163
  data,
164
164
  renderItem,
@@ -450,7 +450,7 @@ describe("DataTableAdditionalFiltersWeb", () => {
450
450
  });
451
451
 
452
452
  it("keeps in-progress drafts when the filters array is recreated", async () => {
453
- const onApply = mock(() => {});
453
+ const onApply = mock((_values: Record<string, unknown>) => {});
454
454
  const departmentFilter = {
455
455
  field: "department",
456
456
  kind: "choice" as const,
@@ -5,7 +5,7 @@ import {useEffect} from "react";
5
5
  import {Text, useWindowDimensions} from "react-native";
6
6
 
7
7
  import type {ListDetailState} from "../Common";
8
- import {renderWithTheme} from "../test-utils";
8
+ import {findAllByHostType, renderWithTheme} from "../test-utils";
9
9
 
10
10
  // This file runs in its own process (src/isolated), so it can install route and router doubles
11
11
  // for the hooks this layout reads without affecting other suites.
@@ -126,9 +126,7 @@ describe("ListDetailLayout", () => {
126
126
  const {getByTestId, queryByTestId} = renderLayout();
127
127
 
128
128
  expect(queryByTestId("list-detail-list-pane")).toBeNull();
129
- expect(
130
- getByTestId("list-detail-detail-pane").findAll((node) => node.type === "Stack")
131
- ).toHaveLength(1);
129
+ expect(findAllByHostType(getByTestId("list-detail-detail-pane"), "Stack")).toHaveLength(1);
132
130
  expect(getByTestId("split-probe").props.children).toBe("stacked");
133
131
  });
134
132
 
@@ -4,7 +4,7 @@ import type {ReactElement} from "react";
4
4
  import {Platform} from "react-native";
5
5
  import {TextField} from "../TextField";
6
6
  import {ThemeProvider} from "../Theme";
7
- import {renderWithTheme} from "../test-utils";
7
+ import {elementProps, renderWithTheme} from "../test-utils";
8
8
  import {LoginScreen} from "./LoginScreen";
9
9
  import type {LoginAccountOption} from "./loginTypes";
10
10
 
@@ -252,7 +252,7 @@ describe("LoginScreen", () => {
252
252
  });
253
253
 
254
254
  it("calls onSubmit with form values when submit button is pressed", async () => {
255
- const onSubmit = mock(() => Promise.resolve());
255
+ const onSubmit = mock((_values: Record<string, string>) => Promise.resolve());
256
256
  const {getByTestId} = renderWithTheme(
257
257
  <LoginScreen fields={defaultFields} onSubmit={onSubmit} />
258
258
  );
@@ -845,14 +845,14 @@ const renderWithHostMocks = (
845
845
  ): ReturnType<typeof render> & {focused: string[]} => {
846
846
  const focused: string[] = [];
847
847
  const result = render(ui, {
848
- createNodeMock: (element: ReactElement<{testID?: string}>) => {
848
+ createNodeMock: (element: ReactElement) => {
849
849
  if (element.type === "form") {
850
850
  return requestSubmit ? {requestSubmit} : {};
851
851
  }
852
852
  return {
853
853
  blur: (): void => {},
854
854
  focus: (): void => {
855
- focused.push(element.props.testID ?? "");
855
+ focused.push(elementProps<{testID?: string}>(element).testID ?? "");
856
856
  },
857
857
  };
858
858
  },
@@ -900,7 +900,7 @@ describe("LoginScreen keyboard and autofill", () => {
900
900
  });
901
901
 
902
902
  it("submits once on Enter in the password field", async () => {
903
- const onSubmit = mock(() => Promise.resolve());
903
+ const onSubmit = mock((_values: Record<string, string>) => Promise.resolve());
904
904
  const {getByTestId} = renderWithTheme(
905
905
  <LoginScreen fields={defaultFields} onSubmit={onSubmit} />
906
906
  );
@@ -973,7 +973,7 @@ describe("LoginScreen keyboard and autofill", () => {
973
973
  Platform.OS = "web";
974
974
  try {
975
975
  const requestSubmit = mock(() => {});
976
- const onSubmit = mock(() => Promise.resolve());
976
+ const onSubmit = mock((_values: Record<string, string>) => Promise.resolve());
977
977
  const {UNSAFE_getByType, getByTestId} = renderWithHostMocks(
978
978
  <LoginScreen fields={defaultFields} onSubmit={onSubmit} />,
979
979
  {requestSubmit}
@@ -2,7 +2,7 @@ import {describe, expect, it, mock, spyOn} from "bun:test";
2
2
  import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
3
3
  import type {ReactElement} from "react";
4
4
  import {ThemeProvider} from "../Theme";
5
- import {renderWithTheme} from "../test-utils";
5
+ import {elementProps, renderWithTheme} from "../test-utils";
6
6
  import {PasswordCard} from "./PasswordCard";
7
7
  import type {PasswordCardSubmission} from "./securityTypes";
8
8
 
@@ -18,11 +18,11 @@ const press = async (element: Parameters<typeof fireEvent.press>[0]): Promise<vo
18
18
  const renderTrackingFocus = (ui: ReactElement): ReturnType<typeof render> & {focused: string[]} => {
19
19
  const focused: string[] = [];
20
20
  const result = render(ui, {
21
- createNodeMock: (element: ReactElement<{testID?: string}>) => ({
21
+ createNodeMock: (element: ReactElement) => ({
22
22
  blur: (): void => {},
23
23
  clear: (): void => {},
24
24
  focus: (): void => {
25
- focused.push(element.props.testID ?? "");
25
+ focused.push(elementProps<{testID?: string}>(element).testID ?? "");
26
26
  },
27
27
  isFocused: (): boolean => false,
28
28
  }),