@patternfly/chatbot 6.8.0-prerelease.8 → 6.9.0-prerelease.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 (307) hide show
  1. package/dist/cjs/CodeModal/CodeModal.js +5 -0
  2. package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +26 -7
  3. package/dist/cjs/MarkdownContent/MarkdownContent.js +79 -166
  4. package/dist/cjs/MarkdownContent/MarkdownRenderer.d.ts +6 -0
  5. package/dist/cjs/MarkdownContent/MarkdownRenderer.js +187 -0
  6. package/dist/cjs/Message/Message.d.ts +3 -4
  7. package/dist/cjs/Message/Message.js +0 -2
  8. package/dist/cjs/MessageBox/MessageBox.js +5 -1
  9. package/dist/cjs/index.d.ts +0 -8
  10. package/dist/cjs/index.js +1 -13
  11. package/dist/css/main.css +18 -3
  12. package/dist/css/main.css.map +1 -1
  13. package/dist/esm/CodeModal/CodeModal.js +5 -0
  14. package/dist/esm/MarkdownContent/MarkdownContent.d.ts +26 -7
  15. package/dist/esm/MarkdownContent/MarkdownContent.js +52 -165
  16. package/dist/esm/MarkdownContent/MarkdownRenderer.d.ts +6 -0
  17. package/dist/esm/MarkdownContent/MarkdownRenderer.js +182 -0
  18. package/dist/esm/Message/Message.d.ts +3 -4
  19. package/dist/esm/Message/Message.js +0 -2
  20. package/dist/esm/MessageBox/MessageBox.js +5 -1
  21. package/dist/esm/index.d.ts +0 -8
  22. package/dist/esm/index.js +0 -8
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/generate-index.js +41 -16
  25. package/generate-index.test.js +68 -0
  26. package/monaco-environment.js +45 -0
  27. package/package.json +20 -2
  28. package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
  29. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -1
  30. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
  31. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -2
  32. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -1
  33. package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts +1 -0
  34. package/patternfly-docs/content/extensions/chatbot/tree-shaking.md +124 -0
  35. package/patternfly-docs/monaco-environment.js +45 -0
  36. package/patternfly-docs/patternfly-docs.css.js +6 -0
  37. package/src/Chatbot/Chatbot.scss +4 -0
  38. package/src/ChatbotContent/ChatbotContent.scss +1 -1
  39. package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
  40. package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
  41. package/src/ChatbotModal/ChatbotModal.scss +10 -0
  42. package/src/CodeModal/CodeModal.tsx +6 -0
  43. package/src/DeepThinking/DeepThinking.test.tsx +10 -12
  44. package/src/MarkdownContent/MarkdownContent.test.tsx +52 -5
  45. package/src/MarkdownContent/MarkdownContent.tsx +77 -220
  46. package/src/MarkdownContent/MarkdownRenderer.tsx +235 -0
  47. package/src/Message/Message.test.tsx +5 -0
  48. package/src/Message/Message.tsx +3 -5
  49. package/src/MessageBox/MessageBox.tsx +13 -1
  50. package/src/ResponseActions/ResponseActions.test.tsx +42 -48
  51. package/src/ToolCall/ToolCall.test.tsx +6 -9
  52. package/src/ToolResponse/ToolResponse.test.tsx +16 -22
  53. package/src/index.ts +0 -12
  54. package/src/test-utils/markdownTestUtils.ts +21 -0
  55. package/tsconfig.json +6 -1
  56. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
  57. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +0 -77
  58. package/dist/cjs/Chatbot/Chatbot.test.d.ts +0 -1
  59. package/dist/cjs/Chatbot/Chatbot.test.js +0 -32
  60. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
  61. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +0 -27
  62. package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +0 -1
  63. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +0 -22
  64. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
  65. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -75
  66. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
  67. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -601
  68. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
  69. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +0 -27
  70. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
  71. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +0 -87
  72. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
  73. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +0 -18
  74. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
  75. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +0 -18
  76. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
  77. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -22
  78. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
  79. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +0 -18
  80. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
  81. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -22
  82. package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
  83. package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -22
  84. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
  85. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -46
  86. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
  87. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -44
  88. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
  89. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -55
  90. package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +0 -1
  91. package/dist/cjs/ChatbotModal/ChatbotModal.test.js +0 -16
  92. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
  93. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +0 -64
  94. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
  95. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -61
  96. package/dist/cjs/CodeModal/CodeModal.test.d.ts +0 -1
  97. package/dist/cjs/CodeModal/CodeModal.test.js +0 -34
  98. package/dist/cjs/Compare/Compare.test.d.ts +0 -1
  99. package/dist/cjs/Compare/Compare.test.js +0 -18
  100. package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +0 -1
  101. package/dist/cjs/DeepThinking/DeepThinking.test.js +0 -146
  102. package/dist/cjs/FileDetails/FileDetails.test.d.ts +0 -1
  103. package/dist/cjs/FileDetails/FileDetails.test.js +0 -42
  104. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
  105. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +0 -79
  106. package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +0 -1
  107. package/dist/cjs/FileDropZone/FileDropZone.test.js +0 -100
  108. package/dist/cjs/FilePreview/FilePreview.test.d.ts +0 -1
  109. package/dist/cjs/FilePreview/FilePreview.test.js +0 -97
  110. package/dist/cjs/ImagePreview/ImagePreview.test.d.ts +0 -1
  111. package/dist/cjs/ImagePreview/ImagePreview.test.js +0 -225
  112. package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +0 -1
  113. package/dist/cjs/MarkdownContent/MarkdownContent.test.js +0 -192
  114. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
  115. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -131
  116. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
  117. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +0 -30
  118. package/dist/cjs/Message/Message.test.d.ts +0 -1
  119. package/dist/cjs/Message/Message.test.js +0 -1128
  120. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
  121. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +0 -25
  122. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
  123. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -25
  124. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
  125. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -25
  126. package/dist/cjs/Message/MessageLoading.test.d.ts +0 -1
  127. package/dist/cjs/Message/MessageLoading.test.js +0 -25
  128. package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
  129. package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +0 -109
  130. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
  131. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +0 -76
  132. package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
  133. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +0 -181
  134. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
  135. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +0 -243
  136. package/dist/cjs/MessageBar/AttachButton.test.d.ts +0 -1
  137. package/dist/cjs/MessageBar/AttachButton.test.js +0 -152
  138. package/dist/cjs/MessageBar/MessageBar.test.d.ts +0 -1
  139. package/dist/cjs/MessageBar/MessageBar.test.js +0 -338
  140. package/dist/cjs/MessageBar/SendButton.test.d.ts +0 -1
  141. package/dist/cjs/MessageBar/SendButton.test.js +0 -58
  142. package/dist/cjs/MessageBar/StopButton.test.d.ts +0 -1
  143. package/dist/cjs/MessageBar/StopButton.test.js +0 -58
  144. package/dist/cjs/MessageBox/JumpButton.test.d.ts +0 -1
  145. package/dist/cjs/MessageBox/JumpButton.test.js +0 -39
  146. package/dist/cjs/MessageBox/MessageBox.test.d.ts +0 -1
  147. package/dist/cjs/MessageBox/MessageBox.test.js +0 -294
  148. package/dist/cjs/MessageDivider/MessageDivider.test.d.ts +0 -1
  149. package/dist/cjs/MessageDivider/MessageDivider.test.js +0 -29
  150. package/dist/cjs/Onboarding/Onboarding.test.d.ts +0 -1
  151. package/dist/cjs/Onboarding/Onboarding.test.js +0 -80
  152. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
  153. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +0 -50
  154. package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +0 -1
  155. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +0 -54
  156. package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +0 -1
  157. package/dist/cjs/ResponseActions/ResponseActions.test.js +0 -455
  158. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
  159. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +0 -25
  160. package/dist/cjs/Settings/SettingsForm.test.d.ts +0 -1
  161. package/dist/cjs/Settings/SettingsForm.test.js +0 -35
  162. package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +0 -1
  163. package/dist/cjs/SourcesCard/SourcesCard.test.js +0 -39
  164. package/dist/cjs/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
  165. package/dist/cjs/SourcesCardBase/SourcesCardBase.test.js +0 -199
  166. package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +0 -1
  167. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +0 -77
  168. package/dist/cjs/ToolCall/ToolCall.test.d.ts +0 -1
  169. package/dist/cjs/ToolCall/ToolCall.test.js +0 -201
  170. package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +0 -1
  171. package/dist/cjs/ToolResponse/ToolResponse.test.js +0 -184
  172. package/dist/cjs/__mocks__/monaco-editor.d.ts +0 -11
  173. package/dist/cjs/__mocks__/monaco-editor.js +0 -18
  174. package/dist/cjs/__mocks__/rehype-external-links.d.ts +0 -2
  175. package/dist/cjs/__mocks__/rehype-external-links.js +0 -4
  176. package/dist/cjs/__mocks__/rehype-highlight.d.ts +0 -2
  177. package/dist/cjs/__mocks__/rehype-highlight.js +0 -4
  178. package/dist/cjs/__mocks__/rehype-sanitize.d.ts +0 -2
  179. package/dist/cjs/__mocks__/rehype-sanitize.js +0 -4
  180. package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +0 -2
  181. package/dist/cjs/__mocks__/rehype-unwrap-images.js +0 -4
  182. package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
  183. package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +0 -72
  184. package/dist/esm/Chatbot/Chatbot.test.d.ts +0 -1
  185. package/dist/esm/Chatbot/Chatbot.test.js +0 -27
  186. package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
  187. package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +0 -22
  188. package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +0 -1
  189. package/dist/esm/ChatbotContent/ChatbotContent.test.js +0 -17
  190. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
  191. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -70
  192. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
  193. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -596
  194. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
  195. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +0 -22
  196. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
  197. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +0 -82
  198. package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
  199. package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +0 -13
  200. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
  201. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +0 -13
  202. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
  203. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -20
  204. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
  205. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +0 -13
  206. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
  207. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -20
  208. package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
  209. package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -20
  210. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
  211. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -44
  212. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
  213. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -42
  214. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
  215. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -50
  216. package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +0 -1
  217. package/dist/esm/ChatbotModal/ChatbotModal.test.js +0 -11
  218. package/dist/esm/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
  219. package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +0 -59
  220. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
  221. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -56
  222. package/dist/esm/CodeModal/CodeModal.test.d.ts +0 -1
  223. package/dist/esm/CodeModal/CodeModal.test.js +0 -29
  224. package/dist/esm/Compare/Compare.test.d.ts +0 -1
  225. package/dist/esm/Compare/Compare.test.js +0 -13
  226. package/dist/esm/DeepThinking/DeepThinking.test.d.ts +0 -1
  227. package/dist/esm/DeepThinking/DeepThinking.test.js +0 -141
  228. package/dist/esm/FileDetails/FileDetails.test.d.ts +0 -1
  229. package/dist/esm/FileDetails/FileDetails.test.js +0 -37
  230. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
  231. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +0 -74
  232. package/dist/esm/FileDropZone/FileDropZone.test.d.ts +0 -1
  233. package/dist/esm/FileDropZone/FileDropZone.test.js +0 -95
  234. package/dist/esm/FilePreview/FilePreview.test.d.ts +0 -1
  235. package/dist/esm/FilePreview/FilePreview.test.js +0 -92
  236. package/dist/esm/ImagePreview/ImagePreview.test.d.ts +0 -1
  237. package/dist/esm/ImagePreview/ImagePreview.test.js +0 -220
  238. package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +0 -1
  239. package/dist/esm/MarkdownContent/MarkdownContent.test.js +0 -187
  240. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
  241. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -126
  242. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
  243. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +0 -25
  244. package/dist/esm/Message/Message.test.d.ts +0 -1
  245. package/dist/esm/Message/Message.test.js +0 -1123
  246. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
  247. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +0 -20
  248. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
  249. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -20
  250. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
  251. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -20
  252. package/dist/esm/Message/MessageLoading.test.d.ts +0 -1
  253. package/dist/esm/Message/MessageLoading.test.js +0 -20
  254. package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
  255. package/dist/esm/Message/QuickResponse/QuickResponse.test.js +0 -104
  256. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
  257. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +0 -48
  258. package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
  259. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +0 -176
  260. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
  261. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +0 -238
  262. package/dist/esm/MessageBar/AttachButton.test.d.ts +0 -1
  263. package/dist/esm/MessageBar/AttachButton.test.js +0 -147
  264. package/dist/esm/MessageBar/MessageBar.test.d.ts +0 -1
  265. package/dist/esm/MessageBar/MessageBar.test.js +0 -333
  266. package/dist/esm/MessageBar/SendButton.test.d.ts +0 -1
  267. package/dist/esm/MessageBar/SendButton.test.js +0 -53
  268. package/dist/esm/MessageBar/StopButton.test.d.ts +0 -1
  269. package/dist/esm/MessageBar/StopButton.test.js +0 -53
  270. package/dist/esm/MessageBox/JumpButton.test.d.ts +0 -1
  271. package/dist/esm/MessageBox/JumpButton.test.js +0 -34
  272. package/dist/esm/MessageBox/MessageBox.test.d.ts +0 -1
  273. package/dist/esm/MessageBox/MessageBox.test.js +0 -289
  274. package/dist/esm/MessageDivider/MessageDivider.test.d.ts +0 -1
  275. package/dist/esm/MessageDivider/MessageDivider.test.js +0 -24
  276. package/dist/esm/Onboarding/Onboarding.test.d.ts +0 -1
  277. package/dist/esm/Onboarding/Onboarding.test.js +0 -75
  278. package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
  279. package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +0 -48
  280. package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +0 -1
  281. package/dist/esm/ResponseActions/ResponseActionButton.test.js +0 -49
  282. package/dist/esm/ResponseActions/ResponseActions.test.d.ts +0 -1
  283. package/dist/esm/ResponseActions/ResponseActions.test.js +0 -450
  284. package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
  285. package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +0 -20
  286. package/dist/esm/Settings/SettingsForm.test.d.ts +0 -1
  287. package/dist/esm/Settings/SettingsForm.test.js +0 -33
  288. package/dist/esm/SourcesCard/SourcesCard.test.d.ts +0 -1
  289. package/dist/esm/SourcesCard/SourcesCard.test.js +0 -34
  290. package/dist/esm/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
  291. package/dist/esm/SourcesCardBase/SourcesCardBase.test.js +0 -194
  292. package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +0 -1
  293. package/dist/esm/TermsOfUse/TermsOfUse.test.js +0 -72
  294. package/dist/esm/ToolCall/ToolCall.test.d.ts +0 -1
  295. package/dist/esm/ToolCall/ToolCall.test.js +0 -196
  296. package/dist/esm/ToolResponse/ToolResponse.test.d.ts +0 -1
  297. package/dist/esm/ToolResponse/ToolResponse.test.js +0 -179
  298. package/dist/esm/__mocks__/monaco-editor.d.ts +0 -11
  299. package/dist/esm/__mocks__/monaco-editor.js +0 -18
  300. package/dist/esm/__mocks__/rehype-external-links.d.ts +0 -2
  301. package/dist/esm/__mocks__/rehype-external-links.js +0 -2
  302. package/dist/esm/__mocks__/rehype-highlight.d.ts +0 -2
  303. package/dist/esm/__mocks__/rehype-highlight.js +0 -2
  304. package/dist/esm/__mocks__/rehype-sanitize.d.ts +0 -2
  305. package/dist/esm/__mocks__/rehype-sanitize.js +0 -2
  306. package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +0 -2
  307. package/dist/esm/__mocks__/rehype-unwrap-images.js +0 -2
@@ -1,333 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- import '@testing-library/jest-dom';
12
- import { DropdownGroup, DropdownItem, DropdownList } from '@patternfly/react-core';
13
- import { RhUiAttentionBellIcon, RhUiCalendarIcon, RhUiClipboardIcon, RhUiCodeIcon } from '@patternfly/react-icons';
14
- import { render, screen } from '@testing-library/react';
15
- import userEvent from '@testing-library/user-event';
16
- import { createRef } from 'react';
17
- import SourceDetailsMenuItem from '../SourceDetailsMenuItem';
18
- import { MessageBar } from './MessageBar';
19
- const ATTACH_MENU_ITEMS = [
20
- _jsx(DropdownList, { children: _jsx(DropdownItem, { className: "pf-chatbot-source-details-dropdown-item", value: "auth-operator Pod", id: "0", children: _jsx(SourceDetailsMenuItem, { icon: _jsxs("svg", { width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { d: "M0 12.5C0 5.87258 5.37258 0.5 12 0.5C18.6274 0.5 24 5.87258 24 12.5C24 19.1274 18.6274 24.5 12 24.5C5.37258 24.5 0 19.1274 0 12.5Z", fill: "currentColor" }), _jsx("g", { clipPath: "url(#clip0_3280_27488)", children: _jsx("path", { d: "M8.25 8.75C8.25 7.92266 8.92266 7.25 9.75 7.25H12C14.0719 7.25 15.75 8.92812 15.75 11C15.75 13.0719 14.0719 14.75 12 14.75H9.75V17C9.75 17.4148 9.41484 17.75 9 17.75C8.58516 17.75 8.25 17.4148 8.25 17V14V8.75ZM9.75 13.25H12C13.2422 13.25 14.25 12.2422 14.25 11C14.25 9.75781 13.2422 8.75 12 8.75H9.75V13.25Z", fill: "white" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_3280_27488", children: _jsx("rect", { width: "7.5", height: "12", fill: "white", transform: "translate(8.25 6.5)" }) }) })] }), name: "auth-operator", type: "Pod" }) }) }, "list-1"),
21
- _jsx(DropdownGroup, { children: _jsxs(DropdownList, { children: [_jsx(DropdownItem, { value: "Alerts", id: "1", icon: _jsx(RhUiAttentionBellIcon, {}), children: "Alerts" }), _jsx(DropdownItem, { value: "Events", id: "2", icon: _jsx(RhUiCalendarIcon, {}), children: "Events" }), _jsx(DropdownItem, { value: "Logs", id: "3", icon: _jsx(RhUiClipboardIcon, {}), children: "Logs" }), _jsx(DropdownItem, { value: "YAML - Status", id: "4", icon: _jsx(RhUiCodeIcon, {}), children: "YAML - Status" }), _jsx(DropdownItem, { value: "YAML - All contents", id: "5", icon: _jsx(RhUiCodeIcon, {}), children: "YAML - All contents" })] }) }, "group2")
22
- ];
23
- const originalSpeechRecognition = window.SpeechRecognition;
24
- const mockSpeechRecognition = () => {
25
- const MockSpeechRecognition = jest.fn().mockImplementation(() => ({
26
- start: jest.fn(),
27
- stop: jest.fn()
28
- }));
29
- MockSpeechRecognition.prototype = {};
30
- window.SpeechRecognition = MockSpeechRecognition;
31
- };
32
- describe('Message bar', () => {
33
- afterAll(() => {
34
- window.SpeechRecognition = originalSpeechRecognition;
35
- });
36
- it('should render correctly', () => {
37
- render(_jsx(MessageBar, { onSendMessage: jest.fn }));
38
- expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
39
- expect(screen.queryByRole('button', { name: 'Send' })).toBeFalsy();
40
- expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
41
- expect(screen.getByRole('textbox', { name: /Send a message.../i })).toBeTruthy();
42
- });
43
- it('can send via enter key', () => __awaiter(void 0, void 0, void 0, function* () {
44
- const spy = jest.fn();
45
- render(_jsx(MessageBar, { onSendMessage: spy }));
46
- const input = screen.getByRole('textbox', { name: /Send a message.../i });
47
- yield userEvent.type(input, 'Hello world');
48
- expect(input).toHaveTextContent('Hello world');
49
- yield userEvent.type(input, '[Enter]');
50
- expect(spy).toHaveBeenCalledTimes(1);
51
- }));
52
- it('calls onChange callback appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
53
- const spy = jest.fn();
54
- render(_jsx(MessageBar, { onSendMessage: jest.fn, onChange: spy }));
55
- const input = screen.getByRole('textbox', { name: /Send a message.../i });
56
- yield userEvent.type(input, 'A');
57
- expect(input).toHaveTextContent('A');
58
- expect(spy).toHaveBeenCalledTimes(1);
59
- expect(spy).toHaveBeenCalledWith(expect.any(Object), 'A');
60
- }));
61
- it('can use specified placeholder text', () => __awaiter(void 0, void 0, void 0, function* () {
62
- render(_jsx(MessageBar, { onSendMessage: jest.fn, placeholder: "test placeholder" }));
63
- const input = screen.getByRole('textbox', { name: /test placeholder/i });
64
- yield userEvent.type(input, 'Hello world');
65
- expect(input).toHaveTextContent('Hello world');
66
- }));
67
- // Send button
68
- // --------------------------------------------------------------------------
69
- it('shows send button when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
70
- render(_jsx(MessageBar, { onSendMessage: jest.fn }));
71
- const input = screen.getByRole('textbox', { name: /Send a message.../i });
72
- yield userEvent.type(input, 'Hello world');
73
- expect(input).toHaveTextContent('Hello world');
74
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
75
- }));
76
- it('can disable send button shown when text is input', () => __awaiter(void 0, void 0, void 0, function* () {
77
- render(_jsx(MessageBar, { onSendMessage: jest.fn, isSendButtonDisabled: true }));
78
- const input = screen.getByRole('textbox', { name: /Send a message.../i });
79
- yield userEvent.type(input, 'Hello world');
80
- expect(input).toHaveTextContent('Hello world');
81
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
82
- expect(screen.getByRole('button', { name: 'Send' })).toBeDisabled();
83
- }));
84
- it('can click send button', () => __awaiter(void 0, void 0, void 0, function* () {
85
- const spy = jest.fn();
86
- render(_jsx(MessageBar, { onSendMessage: spy }));
87
- const input = screen.getByRole('textbox', { name: /Send a message.../i });
88
- yield userEvent.type(input, 'Hello world');
89
- expect(input).toHaveTextContent('Hello world');
90
- const sendButton = screen.getByRole('button', { name: 'Send' });
91
- expect(sendButton).toBeTruthy();
92
- yield userEvent.click(sendButton);
93
- expect(spy).toHaveBeenCalledTimes(1);
94
- }));
95
- it('can always show send button', () => {
96
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true }));
97
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
98
- expect(screen.getByRole('button', { name: 'Send' })).toBeEnabled();
99
- });
100
- it('can disable send button if always showing', () => {
101
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, isSendButtonDisabled: true }));
102
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
103
- expect(screen.getByRole('button', { name: 'Send' })).toBeDisabled();
104
- });
105
- it('can handle buttonProps tooltipContent appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
106
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { tooltipContent: 'Test' } } }));
107
- yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
108
- expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
109
- }));
110
- it('can handle buttonProps tooltipProps appropriately for send', () => {
111
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { tooltipProps: { isVisible: true } } } }));
112
- // isVisible, so no need for click
113
- expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
114
- });
115
- it('can handle buttonProps props appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
116
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { props: { 'aria-label': 'Test' } } } }));
117
- yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
118
- }));
119
- // Attach button
120
- // --------------------------------------------------------------------------
121
- it('can show attach menu', () => __awaiter(void 0, void 0, void 0, function* () {
122
- render(_jsx(MessageBar, { onSendMessage: jest.fn, attachMenuProps: {
123
- isAttachMenuOpen: true,
124
- setIsAttachMenuOpen: jest.fn(),
125
- onAttachMenuToggleClick: jest.fn(),
126
- onAttachMenuInputChange: jest.fn(),
127
- attachMenuItems: ATTACH_MENU_ITEMS
128
- } }));
129
- expect(screen.getByRole('textbox', { name: /Filter menu items/i })).toBeTruthy();
130
- expect(screen.getByRole('menuitem', { name: /auth-operator/i })).toBeTruthy();
131
- expect(screen.getByRole('menuitem', { name: /Alerts/i })).toBeTruthy();
132
- expect(screen.getByRole('menuitem', { name: /Events/i })).toBeTruthy();
133
- expect(screen.getByRole('menuitem', { name: /Logs/i })).toBeTruthy();
134
- expect(screen.getByRole('menuitem', { name: /YAML - Status/i })).toBeTruthy();
135
- expect(screen.getByRole('menuitem', { name: /YAML - All contents/i })).toBeTruthy();
136
- }));
137
- it('can toggle attach menu', () => __awaiter(void 0, void 0, void 0, function* () {
138
- const attachToggleClickSpy = jest.fn();
139
- render(_jsx(MessageBar, { onSendMessage: jest.fn, attachMenuProps: {
140
- isAttachMenuOpen: false,
141
- setIsAttachMenuOpen: jest.fn(),
142
- onAttachMenuToggleClick: attachToggleClickSpy,
143
- onAttachMenuInputChange: jest.fn(),
144
- attachMenuItems: ATTACH_MENU_ITEMS
145
- } }));
146
- expect(screen.queryByRole('textbox', { name: /Filter menu items/i })).toBeFalsy();
147
- expect(screen.queryByRole('menuitem', { name: /auth-operator/i })).toBeFalsy();
148
- expect(screen.queryByRole('menuitem', { name: /Alerts/i })).toBeFalsy();
149
- expect(screen.queryByRole('menuitem', { name: /Events/i })).toBeFalsy();
150
- expect(screen.queryByRole('menuitem', { name: /Logs/i })).toBeFalsy();
151
- expect(screen.queryByRole('menuitem', { name: /YAML - Status/i })).toBeFalsy();
152
- expect(screen.queryByRole('menuitem', { name: /YAML - All contents/i })).toBeFalsy();
153
- const attachButton = screen.getByRole('button', { name: 'Attach' });
154
- yield userEvent.click(attachButton);
155
- expect(attachToggleClickSpy).toHaveBeenCalledTimes(1);
156
- }));
157
- it('can pass searchInputProps to search input in AttachMenu', () => {
158
- render(_jsx(MessageBar, { onSendMessage: jest.fn, value: "test", attachMenuProps: {
159
- isAttachMenuOpen: true,
160
- setIsAttachMenuOpen: jest.fn(),
161
- onAttachMenuToggleClick: jest.fn(),
162
- onAttachMenuInputChange: jest.fn(),
163
- attachMenuItems: ATTACH_MENU_ITEMS,
164
- searchInputProps: { isDisabled: true }
165
- } }));
166
- expect(screen.getByRole('textbox', { name: /Filter menu items/i })).toBeDisabled();
167
- });
168
- it('can pass menuSearchProps to search input in AttachMenu', () => {
169
- render(_jsx(MessageBar, { onSendMessage: jest.fn, value: "test", attachMenuProps: {
170
- isAttachMenuOpen: true,
171
- setIsAttachMenuOpen: jest.fn(),
172
- onAttachMenuToggleClick: jest.fn(),
173
- onAttachMenuInputChange: jest.fn(),
174
- attachMenuItems: ATTACH_MENU_ITEMS,
175
- menuSearchProps: { 'data-testid': 'menu-search' }
176
- } }));
177
- expect(screen.getByTestId('menu-search')).toBeTruthy();
178
- });
179
- it('can pass menuSearchInputProps to search input in AttachMenu', () => {
180
- render(_jsx(MessageBar, { onSendMessage: jest.fn, value: "test", attachMenuProps: {
181
- isAttachMenuOpen: true,
182
- setIsAttachMenuOpen: jest.fn(),
183
- onAttachMenuToggleClick: jest.fn(),
184
- onAttachMenuInputChange: jest.fn(),
185
- attachMenuItems: ATTACH_MENU_ITEMS,
186
- menuSearchInputProps: { 'data-testid': 'menu-search-input' }
187
- } }));
188
- expect(screen.getByTestId('menu-search-input')).toBeTruthy();
189
- });
190
- it('can remove input from attach menu', () => __awaiter(void 0, void 0, void 0, function* () {
191
- render(_jsx(MessageBar, { onSendMessage: jest.fn, attachMenuProps: {
192
- isAttachMenuOpen: true,
193
- setIsAttachMenuOpen: jest.fn(),
194
- onAttachMenuToggleClick: jest.fn(),
195
- attachMenuItems: ATTACH_MENU_ITEMS
196
- } }));
197
- expect(screen.queryByRole('textbox', { name: /Filter menu items/i })).not.toBeInTheDocument();
198
- }));
199
- it('can hide attach button', () => {
200
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAttachButton: false }));
201
- expect(screen.queryByRole('button', { name: 'Attach' })).toBeFalsy();
202
- });
203
- // Based on this because I had no idea how to do this and was looking around: https://stackoverflow.com/a/75562651
204
- // See also https://developer.mozilla.org/en-US/docs/Web/API/File/File for what that file variable is doing
205
- it('can handle handleAttach', () => __awaiter(void 0, void 0, void 0, function* () {
206
- const spy = jest.fn();
207
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, handleAttach: spy, buttonProps: { attach: { inputTestId: 'input' } } }));
208
- expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
209
- yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
210
- const file = new File(['test'], 'test.json');
211
- const input = screen.getByTestId('input');
212
- yield userEvent.upload(input, file);
213
- expect(input.files).toHaveLength(1);
214
- expect(spy).toHaveBeenCalledTimes(1);
215
- }));
216
- it('can handle buttonProps tooltipContent appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
217
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: { attach: { tooltipContent: 'Test' } } }));
218
- yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
219
- expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
220
- }));
221
- it('can handle buttonProps tooltipProps appropriately for attach', () => {
222
- render(_jsx(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { attach: { tooltipProps: { isVisible: true } } } }));
223
- // isVisible, so no need for click
224
- expect(screen.getByRole('tooltip', { name: 'Attach' })).toBeTruthy();
225
- });
226
- it('can handle buttonProps props appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
227
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: { attach: { props: { 'aria-label': 'Test' } } } }));
228
- yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
229
- }));
230
- it('can change attach button icon', () => {
231
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: {
232
- attach: {
233
- icon: _jsx("img", { alt: "", src: "" })
234
- }
235
- } }));
236
- expect(screen.getByRole('img')).toBeVisible();
237
- });
238
- // Stop button
239
- // --------------------------------------------------------------------------
240
- it('can show stop button', () => {
241
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn }));
242
- expect(screen.getByRole('button', { name: 'Stop' })).toBeTruthy();
243
- });
244
- it('can call handleStopButton', () => __awaiter(void 0, void 0, void 0, function* () {
245
- const spy = jest.fn();
246
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: spy }));
247
- yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
248
- expect(spy).toHaveBeenCalledTimes(1);
249
- }));
250
- it('can handle buttonProps tooltipContent appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
251
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { tooltipContent: 'Test' } } }));
252
- yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
253
- expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
254
- }));
255
- it('can handle buttonProps tooltipProps appropriately for stop', () => {
256
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { tooltipProps: { isVisible: true } } } }));
257
- // isVisible, so no need for click
258
- expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
259
- });
260
- it('can handle buttonProps props appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
261
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { props: { 'aria-label': 'Test' } } } }));
262
- yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
263
- }));
264
- // Microphone button
265
- // --------------------------------------------------------------------------
266
- it('can hide microphone button when window.SpeechRecognition is not there', () => {
267
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true }));
268
- expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
269
- });
270
- it('can show microphone button', () => {
271
- mockSpeechRecognition();
272
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true }));
273
- expect(screen.getByRole('button', { name: 'Use microphone' })).toBeTruthy();
274
- });
275
- it('can handle buttonProps appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
276
- mockSpeechRecognition();
277
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: {
278
- microphone: { tooltipContent: { active: 'Currently listening', inactive: 'Not currently listening' } }
279
- } }));
280
- yield userEvent.click(screen.getByRole('button', { name: 'Use microphone' }));
281
- expect(screen.getByRole('tooltip', { name: 'Currently listening' })).toBeTruthy();
282
- yield userEvent.click(screen.getByRole('button', { name: 'Stop listening' }));
283
- expect(screen.getByRole('tooltip', { name: 'Not currently listening' })).toBeTruthy();
284
- }));
285
- it('can customize the listening placeholder', () => __awaiter(void 0, void 0, void 0, function* () {
286
- mockSpeechRecognition();
287
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, listeningText: "I am listening" }));
288
- yield userEvent.click(screen.getByRole('button', { name: 'Use microphone' }));
289
- const input = screen.getByRole('textbox', { name: /I am listening/i });
290
- expect(input).toBeTruthy();
291
- }));
292
- it('can handle buttonProps tooltipProps appropriately for microphone', () => {
293
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { tooltipProps: { isVisible: true } } } }));
294
- // isVisible, so no need for click
295
- expect(screen.getByRole('tooltip', { name: 'Use microphone' })).toBeTruthy();
296
- });
297
- it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
298
- mockSpeechRecognition();
299
- render(_jsx(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
300
- yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
301
- }));
302
- it('can be controlled', () => {
303
- render(_jsx(MessageBar, { onSendMessage: jest.fn, value: "test" }));
304
- expect(screen.getByRole('button', { name: 'Attach' })).toBeTruthy();
305
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
306
- expect(screen.queryByRole('button', { name: 'Use microphone' })).toBeFalsy();
307
- expect(screen.getByRole('textbox', { name: /Send a message.../i })).toBeTruthy();
308
- expect(screen.getByRole('textbox', { name: /Send a message.../i })).toHaveValue('test');
309
- });
310
- it('should focus textarea when using a custom ref', () => {
311
- var _a;
312
- const ref = createRef();
313
- render(_jsx(MessageBar, { onSendMessage: jest.fn, innerRef: ref }));
314
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
315
- expect(document.activeElement).toBe(screen.getByRole('textbox'));
316
- });
317
- it('should handle isPrimary', () => {
318
- const { container } = render(_jsx(MessageBar, { isPrimary: true, onSendMessage: jest.fn }));
319
- expect(container.querySelector('.pf-m-primary')).toBeTruthy();
320
- });
321
- it('Renders with flex-basis of auto by default', () => {
322
- render(_jsx(MessageBar, { onSendMessage: jest.fn }));
323
- expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: auto;');
324
- });
325
- it('Renders with flex-basis of 100% when forceMultilineLayout is true', () => {
326
- render(_jsx(MessageBar, { forceMultilineLayout: true, onSendMessage: jest.fn }));
327
- expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: 100%;');
328
- });
329
- it('Renders with flex-basis of 100% when additionalActions is truthy', () => {
330
- render(_jsx(MessageBar, { additionalActions: "actions", onSendMessage: jest.fn }));
331
- expect(screen.getByRole('textbox').closest('.pf-chatbot__message-bar-input')).toHaveAttribute('style', 'flex-basis: 100%;');
332
- });
333
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,53 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { render, screen } from '@testing-library/react';
12
- import '@testing-library/jest-dom';
13
- import userEvent from '@testing-library/user-event';
14
- import { SendButton } from './SendButton';
15
- const renderSend = (props) => {
16
- const spy = jest.fn();
17
- render(_jsx(SendButton, Object.assign({ onClick: spy }, props)));
18
- };
19
- describe('Send button', () => {
20
- it('should render button correctly', () => {
21
- renderSend();
22
- expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
23
- });
24
- it('should handle onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
25
- const spy = jest.fn();
26
- render(_jsx(SendButton, { onClick: spy }));
27
- yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
28
- expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
29
- expect(spy).toHaveBeenCalledTimes(1);
30
- }));
31
- it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
32
- render(_jsx(SendButton, { onClick: jest.fn, tooltipContent: "Test" }));
33
- yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
34
- expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
35
- }));
36
- it('should handle className prop', () => {
37
- renderSend({ className: 'test' });
38
- expect(screen.getByRole('button', { name: 'Send' })).toHaveClass('test');
39
- });
40
- it('should handle spread props, including aria-label', () => {
41
- renderSend({ 'aria-label': 'test' });
42
- expect(screen.getByRole('button', { name: 'test' }));
43
- });
44
- it('should handle tooltipProps prop', () => __awaiter(void 0, void 0, void 0, function* () {
45
- renderSend({ tooltipProps: { id: 'test' } });
46
- yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
47
- expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
48
- }));
49
- it('should handle isCompact', () => {
50
- renderSend({ 'data-testid': 'button', isCompact: true });
51
- expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
52
- });
53
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,53 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { render, screen } from '@testing-library/react';
12
- import '@testing-library/jest-dom';
13
- import userEvent from '@testing-library/user-event';
14
- import { StopButton } from './StopButton';
15
- const renderStop = (props) => {
16
- const spy = jest.fn();
17
- render(_jsx(StopButton, Object.assign({ onClick: spy }, props)));
18
- };
19
- describe('Stop button', () => {
20
- it('should render button correctly', () => {
21
- renderStop();
22
- expect(screen.getByRole('button', { name: 'Stop' })).toBeTruthy();
23
- });
24
- it('should handle onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
25
- const spy = jest.fn();
26
- render(_jsx(StopButton, { onClick: spy }));
27
- yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
28
- expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
29
- expect(spy).toHaveBeenCalledTimes(1);
30
- }));
31
- it('should handle custom tooltip correctly', () => __awaiter(void 0, void 0, void 0, function* () {
32
- render(_jsx(StopButton, { onClick: jest.fn, tooltipContent: "Test" }));
33
- yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
34
- expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
35
- }));
36
- it('should handle className prop', () => {
37
- renderStop({ className: 'test' });
38
- expect(screen.getByRole('button', { name: 'Stop' })).toHaveClass('test');
39
- });
40
- it('should handle spread props, including aria-label', () => {
41
- renderStop({ 'aria-label': 'test' });
42
- expect(screen.getByRole('button', { name: 'test' }));
43
- });
44
- it('should handle tooltipProps prop', () => __awaiter(void 0, void 0, void 0, function* () {
45
- renderStop({ tooltipProps: { id: 'test' } });
46
- yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
47
- expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
48
- }));
49
- it('should handle isCompact', () => {
50
- renderStop({ 'data-testid': 'button', isCompact: true });
51
- expect(screen.getByTestId('button')).toHaveClass('pf-m-compact');
52
- });
53
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,34 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { render, screen } from '@testing-library/react';
12
- import '@testing-library/jest-dom';
13
- import JumpButton from './JumpButton';
14
- import userEvent from '@testing-library/user-event';
15
- describe('JumpButton', () => {
16
- it('should render top button correctly', () => {
17
- render(_jsx(JumpButton, { position: "top", onClick: jest.fn() }));
18
- expect(screen.getByRole('button', { name: /Back to top/i })).toBeTruthy();
19
- });
20
- it('should render bottom button correctly', () => {
21
- render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn() }));
22
- expect(screen.getByRole('button', { name: /Back to bottom/i })).toBeTruthy();
23
- });
24
- it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
25
- const spy = jest.fn();
26
- render(_jsx(JumpButton, { position: "bottom", onClick: spy }));
27
- yield userEvent.click(screen.getByRole('button', { name: /Back to bottom/i }));
28
- expect(spy).toHaveBeenCalledTimes(1);
29
- }));
30
- it('should be hidden if isHidden prop is used', () => {
31
- render(_jsx(JumpButton, { position: "bottom", onClick: jest.fn(), isHidden: true }));
32
- expect(screen.queryByRole('button', { name: /Back to bottom/i })).toBeFalsy();
33
- });
34
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';