@terreno/ui 57.8.0 → 57.9.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 (134) hide show
  1. package/dist/AreaChart.d.ts +1 -1
  2. package/dist/AreaChart.d.ts.map +1 -1
  3. package/dist/AreaChart.js +70 -22
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarChart.d.ts.map +1 -1
  6. package/dist/BarChart.js +55 -13
  7. package/dist/BarChart.js.map +1 -1
  8. package/dist/ChartCard.d.ts +5 -0
  9. package/dist/ChartCard.d.ts.map +1 -0
  10. package/dist/ChartCard.js +18 -0
  11. package/dist/ChartCard.js.map +1 -0
  12. package/dist/Common.d.ts +79 -5
  13. package/dist/Common.d.ts.map +1 -1
  14. package/dist/Common.js.map +1 -1
  15. package/dist/DashboardGrid.d.ts +6 -2
  16. package/dist/DashboardGrid.d.ts.map +1 -1
  17. package/dist/DashboardGrid.js +43 -10
  18. package/dist/DashboardGrid.js.map +1 -1
  19. package/dist/DonutChart.d.ts.map +1 -1
  20. package/dist/DonutChart.js +20 -10
  21. package/dist/DonutChart.js.map +1 -1
  22. package/dist/DropdownMenuItem.d.ts +16 -0
  23. package/dist/DropdownMenuItem.d.ts.map +1 -0
  24. package/dist/DropdownMenuItem.js +11 -0
  25. package/dist/DropdownMenuItem.js.map +1 -0
  26. package/dist/FilePickerButton.d.ts.map +1 -1
  27. package/dist/FilePickerButton.js +70 -10
  28. package/dist/FilePickerButton.js.map +1 -1
  29. package/dist/GPTChat.d.ts.map +1 -1
  30. package/dist/GPTChat.js +103 -14
  31. package/dist/GPTChat.js.map +1 -1
  32. package/dist/LineChart.d.ts +1 -1
  33. package/dist/LineChart.d.ts.map +1 -1
  34. package/dist/LineChart.js +62 -21
  35. package/dist/LineChart.js.map +1 -1
  36. package/dist/Scorecard.d.ts +5 -0
  37. package/dist/Scorecard.d.ts.map +1 -0
  38. package/dist/Scorecard.js +11 -0
  39. package/dist/Scorecard.js.map +1 -0
  40. package/dist/SparklineChart.d.ts +5 -0
  41. package/dist/SparklineChart.d.ts.map +1 -0
  42. package/dist/SparklineChart.js +35 -0
  43. package/dist/SparklineChart.js.map +1 -0
  44. package/dist/TextField.d.ts.map +1 -1
  45. package/dist/TextField.js +12 -4
  46. package/dist/TextField.js.map +1 -1
  47. package/dist/ToastNotifications.d.ts.map +1 -1
  48. package/dist/ToastNotifications.js +29 -6
  49. package/dist/ToastNotifications.js.map +1 -1
  50. package/dist/WebDropdownMenu.d.ts +2 -1
  51. package/dist/WebDropdownMenu.d.ts.map +1 -1
  52. package/dist/WebDropdownMenu.js +2 -6
  53. package/dist/WebDropdownMenu.js.map +1 -1
  54. package/dist/charts/ChartFacadeContainer.d.ts +10 -0
  55. package/dist/charts/ChartFacadeContainer.d.ts.map +1 -0
  56. package/dist/charts/ChartFacadeContainer.js +10 -0
  57. package/dist/charts/ChartFacadeContainer.js.map +1 -0
  58. package/dist/charts/ChartFrame.d.ts +4 -0
  59. package/dist/charts/ChartFrame.d.ts.map +1 -1
  60. package/dist/charts/ChartFrame.js +4 -2
  61. package/dist/charts/ChartFrame.js.map +1 -1
  62. package/dist/charts/layout.d.ts +9 -2
  63. package/dist/charts/layout.d.ts.map +1 -1
  64. package/dist/charts/layout.js +28 -6
  65. package/dist/charts/layout.js.map +1 -1
  66. package/dist/charts/scales.d.ts +3 -1
  67. package/dist/charts/scales.d.ts.map +1 -1
  68. package/dist/charts/scales.js +7 -7
  69. package/dist/charts/scales.js.map +1 -1
  70. package/dist/charts/series.d.ts +15 -0
  71. package/dist/charts/series.d.ts.map +1 -0
  72. package/dist/charts/series.js +19 -0
  73. package/dist/charts/series.js.map +1 -0
  74. package/dist/charts/types/chartTypes.d.ts +7 -0
  75. package/dist/charts/types/chartTypes.d.ts.map +1 -1
  76. package/dist/dashboardGridLayout.d.ts +6 -0
  77. package/dist/dashboardGridLayout.d.ts.map +1 -1
  78. package/dist/dashboardGridLayout.js +19 -3
  79. package/dist/dashboardGridLayout.js.map +1 -1
  80. package/dist/index.d.ts +4 -1
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/index.js.map +1 -1
  84. package/dist/lazyBoundaries/heavyOptionalExports.d.ts +9 -0
  85. package/dist/lazyBoundaries/heavyOptionalExports.d.ts.map +1 -1
  86. package/dist/lazyBoundaries/heavyOptionalExports.js +6 -0
  87. package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -1
  88. package/dist/resolveDocumentBodyPortalTarget.d.ts +7 -0
  89. package/dist/resolveDocumentBodyPortalTarget.d.ts.map +1 -0
  90. package/dist/resolveDocumentBodyPortalTarget.js +12 -0
  91. package/dist/resolveDocumentBodyPortalTarget.js.map +1 -0
  92. package/package.json +1 -1
  93. package/src/AIRequestExplorer.test.tsx +2 -2
  94. package/src/AreaChart.test.tsx +81 -0
  95. package/src/AreaChart.tsx +171 -62
  96. package/src/BarChart.test.tsx +119 -0
  97. package/src/BarChart.tsx +94 -20
  98. package/src/ChartCard.test.tsx +79 -0
  99. package/src/ChartCard.tsx +80 -0
  100. package/src/Common.ts +69 -2
  101. package/src/DashboardGrid.test.tsx +98 -1
  102. package/src/DashboardGrid.tsx +71 -20
  103. package/src/DonutChart.test.tsx +73 -0
  104. package/src/DonutChart.tsx +87 -14
  105. package/src/DropdownMenuItem.tsx +48 -0
  106. package/src/FilePickerButton.test.tsx +60 -6
  107. package/src/FilePickerButton.tsx +116 -28
  108. package/src/GPTChat.test.tsx +133 -6
  109. package/src/GPTChat.tsx +196 -38
  110. package/src/LineChart.test.tsx +104 -0
  111. package/src/LineChart.tsx +154 -58
  112. package/src/Scorecard.test.tsx +65 -0
  113. package/src/Scorecard.tsx +45 -0
  114. package/src/SparklineChart.test.tsx +69 -0
  115. package/src/SparklineChart.tsx +85 -0
  116. package/src/TextField.test.tsx +16 -0
  117. package/src/TextField.tsx +13 -3
  118. package/src/ToastNotifications.tsx +33 -6
  119. package/src/ToastNotifications.webModal.test.tsx +285 -0
  120. package/src/WebDropdownMenu.tsx +3 -7
  121. package/src/bunSetup.ts +1 -0
  122. package/src/charts/ChartFacadeContainer.tsx +35 -0
  123. package/src/charts/ChartFrame.tsx +39 -1
  124. package/src/charts/layout.test.ts +22 -1
  125. package/src/charts/layout.ts +37 -4
  126. package/src/charts/scales.test.ts +33 -0
  127. package/src/charts/scales.ts +10 -6
  128. package/src/charts/series.ts +43 -0
  129. package/src/charts/types/chartTypes.ts +8 -0
  130. package/src/dashboardGridLayout.test.ts +59 -1
  131. package/src/dashboardGridLayout.ts +30 -3
  132. package/src/index.tsx +6 -0
  133. package/src/lazyBoundaries/heavyOptionalExports.tsx +21 -0
  134. package/src/resolveDocumentBodyPortalTarget.ts +11 -0
@@ -1,10 +1,11 @@
1
1
  import {DateTime} from "luxon";
2
2
  import React, {useCallback, useState} from "react";
3
+ import {Platform} from "react-native";
3
4
 
4
5
  import {Box} from "./Box";
5
- import {Button} from "./Button";
6
+ import {DropdownMenuItem} from "./DropdownMenuItem";
7
+ import {DropdownPanel} from "./DropdownPanel";
6
8
  import {IconButton} from "./IconButton";
7
- import {Modal} from "./Modal";
8
9
 
9
10
  export interface SelectedFile {
10
11
  mimeType: string;
@@ -19,16 +20,87 @@ export interface FilePickerButtonProps {
19
20
  testID?: string;
20
21
  }
21
22
 
23
+ const DOCUMENT_MIME_TYPES = ["application/pdf", "text/plain", "text/csv", "application/json"];
24
+
25
+ const readFileAsDataUrl = (file: File): Promise<string> =>
26
+ new Promise((resolve, reject) => {
27
+ const reader = new FileReader();
28
+ reader.onerror = (): void => reject(reader.error ?? new Error("Failed to read file"));
29
+ reader.onload = (): void => resolve(String(reader.result));
30
+ reader.readAsDataURL(file);
31
+ });
32
+
33
+ /**
34
+ * Opens the browser file dialog. Must run synchronously inside the press handler: browsers
35
+ * only open a file input from a trusted user gesture, which an awaited import would lose.
36
+ * Files resolve as `data:` URLs so they outlive the page, unlike `blob:` object URLs.
37
+ */
38
+ const pickFilesOnWeb = ({
39
+ accept,
40
+ multiple,
41
+ }: {
42
+ accept: string;
43
+ multiple: boolean;
44
+ }): Promise<SelectedFile[]> =>
45
+ new Promise((resolve) => {
46
+ const input = document.createElement("input");
47
+ input.type = "file";
48
+ input.accept = accept;
49
+ input.multiple = multiple;
50
+ input.style.display = "none";
51
+ const cleanup = (): void => {
52
+ input.remove();
53
+ };
54
+ input.addEventListener("change", async () => {
55
+ const files = Array.from(input.files ?? []);
56
+ cleanup();
57
+ try {
58
+ const selected = await Promise.all(
59
+ files.map(async (file) => ({
60
+ mimeType: file.type || "application/octet-stream",
61
+ name: file.name,
62
+ uri: await readFileAsDataUrl(file),
63
+ }))
64
+ );
65
+ resolve(selected);
66
+ } catch (error) {
67
+ console.warn("Failed to read selected files", error);
68
+ resolve([]);
69
+ }
70
+ });
71
+ input.addEventListener("cancel", () => {
72
+ cleanup();
73
+ resolve([]);
74
+ });
75
+ document.body.appendChild(input);
76
+ input.click();
77
+ });
78
+
22
79
  export const FilePickerButton = ({
23
80
  disabled = false,
24
81
  multiple = false,
25
82
  onFilesSelected,
26
83
  testID,
27
84
  }: FilePickerButtonProps): React.ReactElement => {
28
- const [showModal, setShowModal] = useState(false);
85
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
86
+ const triggerTestID = testID ?? "file-picker-button";
87
+
88
+ const handleWebPick = useCallback(
89
+ async (accept: string): Promise<void> => {
90
+ const files = await pickFilesOnWeb({accept, multiple});
91
+ if (files.length > 0) {
92
+ onFilesSelected(files);
93
+ }
94
+ },
95
+ [multiple, onFilesSelected]
96
+ );
29
97
 
30
98
  const handlePickImage = useCallback(async () => {
31
- setShowModal(false);
99
+ setIsMenuOpen(false);
100
+ if (Platform.OS === "web") {
101
+ await handleWebPick("image/*");
102
+ return;
103
+ }
32
104
  const ImagePicker = await import("expo-image-picker");
33
105
  const result = await ImagePicker.launchImageLibraryAsync({
34
106
  allowsMultipleSelection: multiple,
@@ -44,14 +116,18 @@ export const FilePickerButton = ({
44
116
  }));
45
117
  onFilesSelected(files);
46
118
  }
47
- }, [multiple, onFilesSelected]);
119
+ }, [handleWebPick, multiple, onFilesSelected]);
48
120
 
49
121
  const handlePickDocument = useCallback(async () => {
50
- setShowModal(false);
122
+ setIsMenuOpen(false);
123
+ if (Platform.OS === "web") {
124
+ await handleWebPick(DOCUMENT_MIME_TYPES.join(","));
125
+ return;
126
+ }
51
127
  const DocumentPicker = await import("expo-document-picker");
52
128
  const result = await DocumentPicker.getDocumentAsync({
53
129
  multiple,
54
- type: ["application/pdf", "text/plain", "text/csv", "application/json"],
130
+ type: DOCUMENT_MIME_TYPES,
55
131
  });
56
132
 
57
133
  if (!result.canceled && result.assets.length > 0) {
@@ -62,28 +138,40 @@ export const FilePickerButton = ({
62
138
  }));
63
139
  onFilesSelected(files);
64
140
  }
65
- }, [multiple, onFilesSelected]);
141
+ }, [handleWebPick, multiple, onFilesSelected]);
66
142
 
67
143
  return (
68
- <>
69
- <IconButton
70
- accessibilityLabel="Attach file"
71
- disabled={disabled}
72
- iconName="paperclip"
73
- onClick={() => setShowModal(true)}
74
- testID={testID ?? "file-picker-button"}
75
- />
76
- <Modal onDismiss={() => setShowModal(false)} size="sm" title="Attach" visible={showModal}>
77
- <Box gap={2} padding={3}>
78
- <Button
79
- iconName="image"
80
- onClick={handlePickImage}
81
- text="Photo Library"
82
- variant="outline"
83
- />
84
- <Button iconName="file" onClick={handlePickDocument} text="Document" variant="outline" />
85
- </Box>
86
- </Modal>
87
- </>
144
+ <DropdownPanel
145
+ align="auto"
146
+ isOpen={isMenuOpen}
147
+ onOpenChange={setIsMenuOpen}
148
+ renderTrigger={({toggle}) => (
149
+ <IconButton
150
+ accessibilityLabel="Attach file"
151
+ disabled={disabled}
152
+ iconName="paperclip"
153
+ onClick={toggle}
154
+ testID={triggerTestID}
155
+ />
156
+ )}
157
+ showActionButtons={false}
158
+ testID={`${triggerTestID}-menu`}
159
+ width={200}
160
+ >
161
+ <Box gap={1}>
162
+ <DropdownMenuItem
163
+ iconName="image"
164
+ label="Photo Library"
165
+ onClick={handlePickImage}
166
+ testID={`${triggerTestID}-photo`}
167
+ />
168
+ <DropdownMenuItem
169
+ iconName="file"
170
+ label="Document"
171
+ onClick={handlePickDocument}
172
+ testID={`${triggerTestID}-document`}
173
+ />
174
+ </Box>
175
+ </DropdownPanel>
88
176
  );
89
177
  };
@@ -1,6 +1,7 @@
1
1
  import {afterAll, afterEach, describe, it, mock} from "bun:test";
2
2
  import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
3
3
  import {assert} from "chai";
4
+ import {setImageAsync, setStringAsync} from "expo-clipboard";
4
5
  import React from "react";
5
6
  import {Platform, Pressable, ScrollView} from "react-native";
6
7
 
@@ -11,8 +12,8 @@ import {Text} from "./Text";
11
12
  import {ThemeProvider} from "./Theme";
12
13
  import {renderWithTheme} from "./test-utils";
13
14
 
14
- const setStringAsync = mock(async (_text: string) => {});
15
- mock.module("expo-clipboard", () => ({setStringAsync}));
15
+ const mockedSetImageAsync = setImageAsync as unknown as ReturnType<typeof mock>;
16
+ const mockedSetStringAsync = setStringAsync as unknown as ReturnType<typeof mock>;
16
17
 
17
18
  const pickedDocument = {mimeType: "text/plain", name: "notes.txt", uri: "file:///notes.txt"};
18
19
  mock.module("expo-document-picker", () => ({
@@ -91,6 +92,7 @@ describe("GPTChat", () => {
91
92
 
92
93
  await press(getByLabelText("Select chat: First chat"));
93
94
  await press(getByTestId("gpt-new-chat-button"));
95
+ await press(getByTestId("gpt-history-menu-h2"));
94
96
  await press(getByTestId("gpt-delete-history-h2"));
95
97
 
96
98
  assert.deepEqual(onSelectHistory.mock.calls, [["h1"]]);
@@ -102,6 +104,7 @@ describe("GPTChat", () => {
102
104
  const onUpdateTitle = mock((_id: string, _title: string) => {});
103
105
  const {getByTestId} = renderChat({onUpdateTitle});
104
106
 
107
+ await press(getByTestId("gpt-history-menu-h1"));
105
108
  await press(getByTestId("gpt-rename-history-h1"));
106
109
  fireEvent.changeText(getByTestId("gpt-rename-input-h1"), "Renamed");
107
110
  await press(getByTestId("gpt-rename-save-h1"));
@@ -113,6 +116,7 @@ describe("GPTChat", () => {
113
116
  const onUpdateTitle = mock((_id: string, _title: string) => {});
114
117
  const {getByTestId} = renderChat({onUpdateTitle});
115
118
 
119
+ await press(getByTestId("gpt-history-menu-h2"));
116
120
  await press(getByTestId("gpt-rename-history-h2"));
117
121
  fireEvent.changeText(getByTestId("gpt-rename-input-h2"), " ");
118
122
  fireEvent(getByTestId("gpt-rename-input-h2"), "blur");
@@ -120,10 +124,31 @@ describe("GPTChat", () => {
120
124
  assert.equal(onUpdateTitle.mock.calls.length, 0);
121
125
  });
122
126
 
123
- it("hides the rename button when renaming is not supported", () => {
124
- const {queryByTestId} = renderChat();
127
+ it("hides the rename action when renaming is not supported", async () => {
128
+ const {getByTestId, queryByTestId} = renderChat();
129
+
130
+ await press(getByTestId("gpt-history-menu-h1"));
125
131
 
126
132
  assert.isNull(queryByTestId("gpt-rename-history-h1"));
133
+ assert.isOk(getByTestId("gpt-delete-history-h1"));
134
+ });
135
+
136
+ it("keeps rename and delete inside a per-row overflow menu", async () => {
137
+ const {getByTestId, queryByTestId} = renderChat({onUpdateTitle: () => {}});
138
+
139
+ assert.isOk(getByTestId("gpt-history-menu-h1"));
140
+ assert.isNull(queryByTestId("gpt-rename-history-h1"));
141
+ assert.isNull(queryByTestId("gpt-delete-history-h1"));
142
+
143
+ await press(getByTestId("gpt-history-menu-h1"));
144
+
145
+ assert.isOk(getByTestId("gpt-rename-history-h1"));
146
+ assert.isOk(getByTestId("gpt-delete-history-h1"));
147
+
148
+ await press(getByTestId("gpt-rename-history-h1"));
149
+
150
+ assert.isNull(queryByTestId("gpt-delete-history-h1"));
151
+ assert.isOk(getByTestId("gpt-rename-input-h1"));
127
152
  });
128
153
 
129
154
  it("renders a model selector only when models and a change handler are given", () => {
@@ -562,7 +587,7 @@ describe("GPTChat", () => {
562
587
  });
563
588
 
564
589
  it("copies an assistant message to the clipboard", async () => {
565
- setStringAsync.mockClear();
590
+ mockedSetStringAsync.mockClear();
566
591
  const {getByTestId} = renderChat({
567
592
  currentMessages: [{content: "Copy me", role: "assistant"}],
568
593
  });
@@ -571,7 +596,63 @@ describe("GPTChat", () => {
571
596
  fireEvent.press(getByTestId("gpt-copy-msg-0"));
572
597
  });
573
598
 
574
- assert.deepEqual(setStringAsync.mock.calls, [["Copy me"]]);
599
+ assert.deepEqual(mockedSetStringAsync.mock.calls, [["Copy me"]]);
600
+ });
601
+
602
+ it("copies the image, not placeholder text, for an image-only reply", async () => {
603
+ mockedSetStringAsync.mockClear();
604
+ mockedSetImageAsync.mockClear();
605
+ const {getByTestId} = renderChat({
606
+ currentMessages: [
607
+ {
608
+ content: "",
609
+ contentParts: [{mimeType: "image/png", type: "image", url: "data:image/png;base64,AAAA"}],
610
+ role: "assistant",
611
+ },
612
+ ],
613
+ });
614
+
615
+ await press(getByTestId("gpt-copy-msg-0"));
616
+
617
+ assert.deepEqual(mockedSetImageAsync.mock.calls, [["AAAA"]]);
618
+ assert.equal(mockedSetStringAsync.mock.calls.length, 0);
619
+ });
620
+
621
+ it("offers a copy-image action on generated images", async () => {
622
+ mockedSetImageAsync.mockClear();
623
+ const {getByTestId} = renderChat({
624
+ currentMessages: [
625
+ {
626
+ content: "Here you go",
627
+ contentParts: [{mimeType: "image/png", type: "image", url: "data:image/png;base64,BBBB"}],
628
+ role: "assistant",
629
+ },
630
+ ],
631
+ });
632
+
633
+ await press(getByTestId("gpt-copy-image"));
634
+
635
+ assert.deepEqual(mockedSetImageAsync.mock.calls, [["BBBB"]]);
636
+ });
637
+
638
+ it("grows the composer up to a maximum height and resets after sending", async () => {
639
+ const {getByTestId} = renderChat();
640
+ const input = getByTestId("gpt-input");
641
+ fireEvent.changeText(input, "Long pasted notes");
642
+
643
+ fireEvent(input, "contentSizeChange", {nativeEvent: {contentSize: {height: 120, width: 100}}});
644
+ const grownStyle = [getByTestId("gpt-input").props.style].flat(Infinity);
645
+ assert.isTrue(grownStyle.some((style) => style?.height === 120));
646
+
647
+ fireEvent(getByTestId("gpt-input"), "contentSizeChange", {
648
+ nativeEvent: {contentSize: {height: 900, width: 100}},
649
+ });
650
+ const cappedStyle = [getByTestId("gpt-input").props.style].flat(Infinity);
651
+ assert.isTrue(cappedStyle.some((style) => style?.height === 200));
652
+
653
+ await press(getByTestId("gpt-submit"));
654
+ const resetStyle = [getByTestId("gpt-input").props.style].flat(Infinity);
655
+ assert.isTrue(resetStyle.some((style) => style?.height === 40));
575
656
  });
576
657
 
577
658
  it("disables input and the attachment picker while streaming", () => {
@@ -619,6 +700,51 @@ describe("GPTChat", () => {
619
700
  assert.isNull(queryByText("Scroll to bottom"));
620
701
  });
621
702
 
703
+ it("never shows scroll to bottom in an empty chat", async () => {
704
+ const {getByTestId, queryByText, UNSAFE_getByType} = renderChat({currentMessages: []});
705
+
706
+ fireEvent(getByTestId("gpt-viewport"), "layout", {
707
+ nativeEvent: {layout: {height: 200, width: 100, x: 0, y: 0}},
708
+ });
709
+ fireEvent(getByTestId("gpt-messages"), "layout", {
710
+ nativeEvent: {layout: {height: 600, width: 100, x: 0, y: 0}},
711
+ });
712
+ await act(async () => {
713
+ fireEvent.scroll(UNSAFE_getByType(ScrollView), {
714
+ nativeEvent: {contentOffset: {x: 0, y: 0}},
715
+ });
716
+ });
717
+
718
+ assert.isNull(queryByText("Scroll to bottom"));
719
+ });
720
+
721
+ it("hides scroll to bottom once the content fits the viewport", async () => {
722
+ const {getByTestId, getByText, queryByText, UNSAFE_getByType} = renderChat({
723
+ currentMessages: [{content: "Hello!", role: "assistant"}],
724
+ });
725
+
726
+ fireEvent(getByTestId("gpt-viewport"), "layout", {
727
+ nativeEvent: {layout: {height: 200, width: 100, x: 0, y: 0}},
728
+ });
729
+ fireEvent(getByTestId("gpt-messages"), "layout", {
730
+ nativeEvent: {layout: {height: 600, width: 100, x: 0, y: 0}},
731
+ });
732
+ await act(async () => {
733
+ fireEvent.scroll(UNSAFE_getByType(ScrollView), {
734
+ nativeEvent: {contentOffset: {x: 0, y: 0}},
735
+ });
736
+ });
737
+ assert.isOk(getByText("Scroll to bottom"));
738
+
739
+ await act(async () => {
740
+ fireEvent(getByTestId("gpt-messages"), "layout", {
741
+ nativeEvent: {layout: {height: 150, width: 100, x: 0, y: 0}},
742
+ });
743
+ });
744
+
745
+ assert.isNull(queryByText("Scroll to bottom"));
746
+ });
747
+
622
748
  it("renders attachments and the attach button", () => {
623
749
  const onAttachFiles = mock(() => {});
624
750
  const onRemoveAttachment = mock((_index: number) => {});
@@ -668,6 +794,7 @@ describe("GPTChat", () => {
668
794
  const onUpdateTitle = mock((_id: string, _title: string) => {});
669
795
  const {getByTestId} = renderChat({onUpdateTitle});
670
796
 
797
+ await press(getByTestId("gpt-history-menu-h1"));
671
798
  await press(getByTestId("gpt-rename-history-h1"));
672
799
  fireEvent.changeText(getByTestId("gpt-rename-input-h1"), "Renamed");
673
800
  const input = getByTestId("gpt-rename-input-h1");