@patternfly/chatbot 6.8.0-prerelease.7 → 6.8.0-prerelease.9

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 (321) hide show
  1. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
  2. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +125 -16
  3. package/dist/cjs/CodeModal/CodeModal.js +5 -0
  4. package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +26 -7
  5. package/dist/cjs/MarkdownContent/MarkdownContent.js +79 -166
  6. package/dist/cjs/MarkdownContent/MarkdownRenderer.d.ts +6 -0
  7. package/dist/cjs/MarkdownContent/MarkdownRenderer.js +187 -0
  8. package/dist/cjs/Message/Message.d.ts +3 -4
  9. package/dist/cjs/Message/Message.js +0 -2
  10. package/dist/cjs/MessageBox/MessageBox.d.ts +2 -0
  11. package/dist/cjs/MessageBox/MessageBox.js +7 -2
  12. package/dist/cjs/index.d.ts +0 -8
  13. package/dist/cjs/index.js +1 -13
  14. package/dist/css/main.css +77 -10
  15. package/dist/css/main.css.map +1 -1
  16. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
  17. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +128 -19
  18. package/dist/esm/CodeModal/CodeModal.js +5 -0
  19. package/dist/esm/MarkdownContent/MarkdownContent.d.ts +26 -7
  20. package/dist/esm/MarkdownContent/MarkdownContent.js +52 -165
  21. package/dist/esm/MarkdownContent/MarkdownRenderer.d.ts +6 -0
  22. package/dist/esm/MarkdownContent/MarkdownRenderer.js +182 -0
  23. package/dist/esm/Message/Message.d.ts +3 -4
  24. package/dist/esm/Message/Message.js +0 -2
  25. package/dist/esm/MessageBox/MessageBox.d.ts +2 -0
  26. package/dist/esm/MessageBox/MessageBox.js +7 -2
  27. package/dist/esm/index.d.ts +0 -8
  28. package/dist/esm/index.js +0 -8
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/generate-index.js +41 -16
  31. package/generate-index.test.js +68 -0
  32. package/monaco-environment.js +45 -0
  33. package/package.json +20 -2
  34. package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
  35. package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -1
  36. package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
  37. package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -2
  38. package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -1
  39. package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts +1 -0
  40. package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithExpandableGroups.tsx +104 -0
  41. package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +12 -1
  42. package/patternfly-docs/content/extensions/chatbot/tree-shaking.md +124 -0
  43. package/patternfly-docs/monaco-environment.js +45 -0
  44. package/patternfly-docs/patternfly-docs.css.js +6 -0
  45. package/src/Chatbot/Chatbot.scss +4 -0
  46. package/src/ChatbotContent/ChatbotContent.scss +1 -1
  47. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +52 -6
  48. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +551 -3
  49. package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +350 -49
  50. package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
  51. package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
  52. package/src/ChatbotModal/ChatbotModal.scss +10 -0
  53. package/src/ChatbotToggle/ChatbotToggle.scss +6 -0
  54. package/src/CodeModal/CodeModal.tsx +6 -0
  55. package/src/DeepThinking/DeepThinking.test.tsx +10 -12
  56. package/src/MarkdownContent/MarkdownContent.test.tsx +52 -5
  57. package/src/MarkdownContent/MarkdownContent.tsx +77 -220
  58. package/src/MarkdownContent/MarkdownRenderer.tsx +235 -0
  59. package/src/Message/Message.scss +5 -0
  60. package/src/Message/Message.test.tsx +5 -0
  61. package/src/Message/Message.tsx +3 -5
  62. package/src/MessageBox/MessageBox.scss +15 -1
  63. package/src/MessageBox/MessageBox.tsx +23 -2
  64. package/src/ResponseActions/ResponseActions.test.tsx +42 -48
  65. package/src/ToolCall/ToolCall.test.tsx +6 -9
  66. package/src/ToolResponse/ToolResponse.test.tsx +16 -22
  67. package/src/index.ts +0 -12
  68. package/src/test-utils/markdownTestUtils.ts +21 -0
  69. package/tsconfig.json +6 -1
  70. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
  71. package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +0 -77
  72. package/dist/cjs/Chatbot/Chatbot.test.d.ts +0 -1
  73. package/dist/cjs/Chatbot/Chatbot.test.js +0 -32
  74. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
  75. package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +0 -27
  76. package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +0 -1
  77. package/dist/cjs/ChatbotContent/ChatbotContent.test.js +0 -22
  78. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
  79. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -75
  80. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
  81. package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -277
  82. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
  83. package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +0 -27
  84. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
  85. package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +0 -87
  86. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
  87. package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +0 -18
  88. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
  89. package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +0 -18
  90. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
  91. package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -22
  92. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
  93. package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +0 -18
  94. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
  95. package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -22
  96. package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
  97. package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -22
  98. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
  99. package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -46
  100. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
  101. package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -44
  102. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
  103. package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -55
  104. package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +0 -1
  105. package/dist/cjs/ChatbotModal/ChatbotModal.test.js +0 -16
  106. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
  107. package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +0 -64
  108. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
  109. package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -61
  110. package/dist/cjs/CodeModal/CodeModal.test.d.ts +0 -1
  111. package/dist/cjs/CodeModal/CodeModal.test.js +0 -34
  112. package/dist/cjs/Compare/Compare.test.d.ts +0 -1
  113. package/dist/cjs/Compare/Compare.test.js +0 -18
  114. package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +0 -1
  115. package/dist/cjs/DeepThinking/DeepThinking.test.js +0 -146
  116. package/dist/cjs/FileDetails/FileDetails.test.d.ts +0 -1
  117. package/dist/cjs/FileDetails/FileDetails.test.js +0 -42
  118. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
  119. package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +0 -79
  120. package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +0 -1
  121. package/dist/cjs/FileDropZone/FileDropZone.test.js +0 -100
  122. package/dist/cjs/FilePreview/FilePreview.test.d.ts +0 -1
  123. package/dist/cjs/FilePreview/FilePreview.test.js +0 -97
  124. package/dist/cjs/ImagePreview/ImagePreview.test.d.ts +0 -1
  125. package/dist/cjs/ImagePreview/ImagePreview.test.js +0 -225
  126. package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +0 -1
  127. package/dist/cjs/MarkdownContent/MarkdownContent.test.js +0 -192
  128. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
  129. package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -131
  130. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
  131. package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +0 -30
  132. package/dist/cjs/Message/Message.test.d.ts +0 -1
  133. package/dist/cjs/Message/Message.test.js +0 -1128
  134. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
  135. package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +0 -25
  136. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
  137. package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -25
  138. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
  139. package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -25
  140. package/dist/cjs/Message/MessageLoading.test.d.ts +0 -1
  141. package/dist/cjs/Message/MessageLoading.test.js +0 -25
  142. package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
  143. package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +0 -109
  144. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
  145. package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +0 -76
  146. package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
  147. package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +0 -181
  148. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
  149. package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +0 -243
  150. package/dist/cjs/MessageBar/AttachButton.test.d.ts +0 -1
  151. package/dist/cjs/MessageBar/AttachButton.test.js +0 -152
  152. package/dist/cjs/MessageBar/MessageBar.test.d.ts +0 -1
  153. package/dist/cjs/MessageBar/MessageBar.test.js +0 -338
  154. package/dist/cjs/MessageBar/SendButton.test.d.ts +0 -1
  155. package/dist/cjs/MessageBar/SendButton.test.js +0 -58
  156. package/dist/cjs/MessageBar/StopButton.test.d.ts +0 -1
  157. package/dist/cjs/MessageBar/StopButton.test.js +0 -58
  158. package/dist/cjs/MessageBox/JumpButton.test.d.ts +0 -1
  159. package/dist/cjs/MessageBox/JumpButton.test.js +0 -39
  160. package/dist/cjs/MessageBox/MessageBox.test.d.ts +0 -1
  161. package/dist/cjs/MessageBox/MessageBox.test.js +0 -294
  162. package/dist/cjs/MessageDivider/MessageDivider.test.d.ts +0 -1
  163. package/dist/cjs/MessageDivider/MessageDivider.test.js +0 -29
  164. package/dist/cjs/Onboarding/Onboarding.test.d.ts +0 -1
  165. package/dist/cjs/Onboarding/Onboarding.test.js +0 -80
  166. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
  167. package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +0 -50
  168. package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +0 -1
  169. package/dist/cjs/ResponseActions/ResponseActionButton.test.js +0 -54
  170. package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +0 -1
  171. package/dist/cjs/ResponseActions/ResponseActions.test.js +0 -455
  172. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
  173. package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +0 -25
  174. package/dist/cjs/Settings/SettingsForm.test.d.ts +0 -1
  175. package/dist/cjs/Settings/SettingsForm.test.js +0 -35
  176. package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +0 -1
  177. package/dist/cjs/SourcesCard/SourcesCard.test.js +0 -39
  178. package/dist/cjs/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
  179. package/dist/cjs/SourcesCardBase/SourcesCardBase.test.js +0 -199
  180. package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +0 -1
  181. package/dist/cjs/TermsOfUse/TermsOfUse.test.js +0 -77
  182. package/dist/cjs/ToolCall/ToolCall.test.d.ts +0 -1
  183. package/dist/cjs/ToolCall/ToolCall.test.js +0 -201
  184. package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +0 -1
  185. package/dist/cjs/ToolResponse/ToolResponse.test.js +0 -184
  186. package/dist/cjs/__mocks__/monaco-editor.d.ts +0 -11
  187. package/dist/cjs/__mocks__/monaco-editor.js +0 -18
  188. package/dist/cjs/__mocks__/rehype-external-links.d.ts +0 -2
  189. package/dist/cjs/__mocks__/rehype-external-links.js +0 -4
  190. package/dist/cjs/__mocks__/rehype-highlight.d.ts +0 -2
  191. package/dist/cjs/__mocks__/rehype-highlight.js +0 -4
  192. package/dist/cjs/__mocks__/rehype-sanitize.d.ts +0 -2
  193. package/dist/cjs/__mocks__/rehype-sanitize.js +0 -4
  194. package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +0 -2
  195. package/dist/cjs/__mocks__/rehype-unwrap-images.js +0 -4
  196. package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
  197. package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +0 -72
  198. package/dist/esm/Chatbot/Chatbot.test.d.ts +0 -1
  199. package/dist/esm/Chatbot/Chatbot.test.js +0 -27
  200. package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
  201. package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +0 -22
  202. package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +0 -1
  203. package/dist/esm/ChatbotContent/ChatbotContent.test.js +0 -17
  204. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
  205. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -70
  206. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
  207. package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -272
  208. package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
  209. package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +0 -22
  210. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
  211. package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +0 -82
  212. package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
  213. package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +0 -13
  214. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
  215. package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +0 -13
  216. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
  217. package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -20
  218. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
  219. package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +0 -13
  220. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
  221. package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -20
  222. package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
  223. package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -20
  224. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
  225. package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -44
  226. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
  227. package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -42
  228. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
  229. package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -50
  230. package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +0 -1
  231. package/dist/esm/ChatbotModal/ChatbotModal.test.js +0 -11
  232. package/dist/esm/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
  233. package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +0 -59
  234. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
  235. package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -56
  236. package/dist/esm/CodeModal/CodeModal.test.d.ts +0 -1
  237. package/dist/esm/CodeModal/CodeModal.test.js +0 -29
  238. package/dist/esm/Compare/Compare.test.d.ts +0 -1
  239. package/dist/esm/Compare/Compare.test.js +0 -13
  240. package/dist/esm/DeepThinking/DeepThinking.test.d.ts +0 -1
  241. package/dist/esm/DeepThinking/DeepThinking.test.js +0 -141
  242. package/dist/esm/FileDetails/FileDetails.test.d.ts +0 -1
  243. package/dist/esm/FileDetails/FileDetails.test.js +0 -37
  244. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
  245. package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +0 -74
  246. package/dist/esm/FileDropZone/FileDropZone.test.d.ts +0 -1
  247. package/dist/esm/FileDropZone/FileDropZone.test.js +0 -95
  248. package/dist/esm/FilePreview/FilePreview.test.d.ts +0 -1
  249. package/dist/esm/FilePreview/FilePreview.test.js +0 -92
  250. package/dist/esm/ImagePreview/ImagePreview.test.d.ts +0 -1
  251. package/dist/esm/ImagePreview/ImagePreview.test.js +0 -220
  252. package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +0 -1
  253. package/dist/esm/MarkdownContent/MarkdownContent.test.js +0 -187
  254. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
  255. package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -126
  256. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
  257. package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +0 -25
  258. package/dist/esm/Message/Message.test.d.ts +0 -1
  259. package/dist/esm/Message/Message.test.js +0 -1123
  260. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
  261. package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +0 -20
  262. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
  263. package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -20
  264. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
  265. package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -20
  266. package/dist/esm/Message/MessageLoading.test.d.ts +0 -1
  267. package/dist/esm/Message/MessageLoading.test.js +0 -20
  268. package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
  269. package/dist/esm/Message/QuickResponse/QuickResponse.test.js +0 -104
  270. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
  271. package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +0 -48
  272. package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
  273. package/dist/esm/Message/UserFeedback/UserFeedback.test.js +0 -176
  274. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
  275. package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +0 -238
  276. package/dist/esm/MessageBar/AttachButton.test.d.ts +0 -1
  277. package/dist/esm/MessageBar/AttachButton.test.js +0 -147
  278. package/dist/esm/MessageBar/MessageBar.test.d.ts +0 -1
  279. package/dist/esm/MessageBar/MessageBar.test.js +0 -333
  280. package/dist/esm/MessageBar/SendButton.test.d.ts +0 -1
  281. package/dist/esm/MessageBar/SendButton.test.js +0 -53
  282. package/dist/esm/MessageBar/StopButton.test.d.ts +0 -1
  283. package/dist/esm/MessageBar/StopButton.test.js +0 -53
  284. package/dist/esm/MessageBox/JumpButton.test.d.ts +0 -1
  285. package/dist/esm/MessageBox/JumpButton.test.js +0 -34
  286. package/dist/esm/MessageBox/MessageBox.test.d.ts +0 -1
  287. package/dist/esm/MessageBox/MessageBox.test.js +0 -289
  288. package/dist/esm/MessageDivider/MessageDivider.test.d.ts +0 -1
  289. package/dist/esm/MessageDivider/MessageDivider.test.js +0 -24
  290. package/dist/esm/Onboarding/Onboarding.test.d.ts +0 -1
  291. package/dist/esm/Onboarding/Onboarding.test.js +0 -75
  292. package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
  293. package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +0 -48
  294. package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +0 -1
  295. package/dist/esm/ResponseActions/ResponseActionButton.test.js +0 -49
  296. package/dist/esm/ResponseActions/ResponseActions.test.d.ts +0 -1
  297. package/dist/esm/ResponseActions/ResponseActions.test.js +0 -450
  298. package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
  299. package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +0 -20
  300. package/dist/esm/Settings/SettingsForm.test.d.ts +0 -1
  301. package/dist/esm/Settings/SettingsForm.test.js +0 -33
  302. package/dist/esm/SourcesCard/SourcesCard.test.d.ts +0 -1
  303. package/dist/esm/SourcesCard/SourcesCard.test.js +0 -34
  304. package/dist/esm/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
  305. package/dist/esm/SourcesCardBase/SourcesCardBase.test.js +0 -194
  306. package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +0 -1
  307. package/dist/esm/TermsOfUse/TermsOfUse.test.js +0 -72
  308. package/dist/esm/ToolCall/ToolCall.test.d.ts +0 -1
  309. package/dist/esm/ToolCall/ToolCall.test.js +0 -196
  310. package/dist/esm/ToolResponse/ToolResponse.test.d.ts +0 -1
  311. package/dist/esm/ToolResponse/ToolResponse.test.js +0 -179
  312. package/dist/esm/__mocks__/monaco-editor.d.ts +0 -11
  313. package/dist/esm/__mocks__/monaco-editor.js +0 -18
  314. package/dist/esm/__mocks__/rehype-external-links.d.ts +0 -2
  315. package/dist/esm/__mocks__/rehype-external-links.js +0 -2
  316. package/dist/esm/__mocks__/rehype-highlight.d.ts +0 -2
  317. package/dist/esm/__mocks__/rehype-highlight.js +0 -2
  318. package/dist/esm/__mocks__/rehype-sanitize.d.ts +0 -2
  319. package/dist/esm/__mocks__/rehype-sanitize.js +0 -2
  320. package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +0 -2
  321. package/dist/esm/__mocks__/rehype-unwrap-images.js +0 -2
@@ -1,450 +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 { render, screen } from '@testing-library/react';
12
- import '@testing-library/jest-dom';
13
- import ResponseActions from './ResponseActions';
14
- import userEvent from '@testing-library/user-event';
15
- import { RhUiExportIcon, RhMicronsInformationFillIcon, RhUiRedoIcon } from '@patternfly/react-icons';
16
- import Message from '../Message';
17
- // Mock the icon components
18
- jest.mock('@patternfly/react-icons', () => ({
19
- RhUiLikeIcon: () => _jsx("div", { children: "RhUiLikeIcon" }),
20
- RhUiLikeFillIcon: () => _jsx("div", { children: "RhUiLikeFillIcon" }),
21
- RhUiDislikeIcon: () => _jsx("div", { children: "RhUiDislikeIcon" }),
22
- RhUiDislikeFillIcon: () => _jsx("div", { children: "RhUiDislikeFillIcon" }),
23
- RhUiCopyIcon: () => _jsx("div", { children: "RhUiCopyIcon" }),
24
- RhUiCopyFillIcon: () => _jsx("div", { children: "RhUiCopyFillIcon" }),
25
- RhUiEditIcon: () => _jsx("div", { children: "RhUiEditIcon" }),
26
- RhUiEditFillIcon: () => _jsx("div", { children: "RhUiEditFillIcon" }),
27
- RhUiVolumeUpIcon: () => _jsx("div", { children: "RhUiVolumeUpIcon" }),
28
- RhUiVolumeUpFillIcon: () => _jsx("div", { children: "RhUiVolumeUpFillIcon" }),
29
- RhUiExportIcon: () => _jsx("div", { children: "RhUiExportIcon" }),
30
- RhUiExportFillIcon: () => _jsx("div", { children: "RhUiExportFillIcon" }),
31
- RhMicronsInformationFillIcon: () => _jsx("div", { children: "RhMicronsInformationFillIcon" }),
32
- RhUiRedoIcon: () => _jsx("div", { children: "RhUiRedoIcon" })
33
- }));
34
- const ALL_ACTIONS = [
35
- { type: 'positive', label: 'Good response', clickedLabel: 'Good response recorded' },
36
- { type: 'negative', label: 'Bad response', clickedLabel: 'Bad response recorded' },
37
- { type: 'copy', label: 'Copy', clickedLabel: 'Copied' },
38
- { type: 'edit', label: 'Edit', clickedLabel: 'Editing' },
39
- { type: 'share', label: 'Share', clickedLabel: 'Shared' },
40
- { type: 'listen', label: 'Listen', clickedLabel: 'Listening' }
41
- ];
42
- const CUSTOM_ACTIONS = [
43
- {
44
- regenerate: {
45
- ariaLabel: 'Regenerate',
46
- clickedAriaLabel: 'Regenerated',
47
- onClick: jest.fn(),
48
- tooltipContent: 'Regenerate',
49
- clickedTooltipContent: 'Regenerated',
50
- icon: _jsx(RhUiRedoIcon, {})
51
- },
52
- download: {
53
- ariaLabel: 'Download',
54
- clickedAriaLabel: 'Downloaded',
55
- onClick: jest.fn(),
56
- tooltipContent: 'Download',
57
- clickedTooltipContent: 'Downloaded',
58
- icon: _jsx(RhUiExportIcon, {})
59
- },
60
- info: {
61
- ariaLabel: 'Info',
62
- onClick: jest.fn(),
63
- tooltipContent: 'Info',
64
- icon: _jsx(RhMicronsInformationFillIcon, {})
65
- }
66
- }
67
- ];
68
- const ALL_ACTIONS_DATA_TEST = [
69
- { type: 'positive', label: 'Good response', dataTestId: 'positive' },
70
- { type: 'negative', label: 'Bad response', dataTestId: 'negative' },
71
- { type: 'copy', label: 'Copy', dataTestId: 'copy' },
72
- { type: 'edit', label: 'Edit', dataTestId: 'edit' },
73
- { type: 'share', label: 'Share', dataTestId: 'share' },
74
- { type: 'download', label: 'Download', dataTestId: 'download' },
75
- { type: 'listen', label: 'Listen', dataTestId: 'listen' }
76
- ];
77
- describe('ResponseActions', () => {
78
- afterEach(() => {
79
- jest.clearAllMocks();
80
- });
81
- it('should handle click within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
82
- render(_jsx(ResponseActions, { actions: {
83
- positive: { onClick: jest.fn() },
84
- negative: { onClick: jest.fn() },
85
- copy: { onClick: jest.fn() },
86
- edit: { onClick: jest.fn() },
87
- share: { onClick: jest.fn() },
88
- download: { onClick: jest.fn() },
89
- listen: { onClick: jest.fn() }
90
- } }));
91
- const goodBtn = screen.getByRole('button', { name: 'Good response' });
92
- const badBtn = screen.getByRole('button', { name: 'Bad response' });
93
- const copyBtn = screen.getByRole('button', { name: 'Copy' });
94
- const editBtn = screen.getByRole('button', { name: 'Edit' });
95
- const shareBtn = screen.getByRole('button', { name: 'Share' });
96
- const downloadBtn = screen.getByRole('button', { name: 'Download' });
97
- const listenBtn = screen.getByRole('button', { name: 'Listen' });
98
- const buttons = [goodBtn, badBtn, copyBtn, editBtn, shareBtn, downloadBtn, listenBtn];
99
- buttons.forEach((button) => {
100
- expect(button).toBeTruthy();
101
- });
102
- yield userEvent.click(goodBtn);
103
- expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
104
- let unclickedButtons = buttons.filter((button) => button !== goodBtn);
105
- unclickedButtons.forEach((button) => {
106
- expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
107
- });
108
- yield userEvent.click(badBtn);
109
- expect(screen.getByRole('button', { name: 'Bad response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
110
- unclickedButtons = buttons.filter((button) => button !== badBtn);
111
- unclickedButtons.forEach((button) => {
112
- expect(button).not.toHaveClass('pf-chatbot__button--response-action-clicked');
113
- });
114
- }));
115
- it('should handle click outside of group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
116
- // using message just so we have something outside the group that's rendered
117
- render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "I updated your account with those settings. You're ready to set up your first dashboard!", actions: {
118
- positive: {},
119
- negative: {}
120
- } }));
121
- const goodBtn = screen.getByRole('button', { name: 'Good response' });
122
- const badBtn = screen.getByRole('button', { name: 'Bad response' });
123
- expect(goodBtn).toBeTruthy();
124
- expect(badBtn).toBeTruthy();
125
- yield userEvent.click(goodBtn);
126
- expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
127
- expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
128
- yield userEvent.click(badBtn);
129
- expect(screen.getByRole('button', { name: 'Bad response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
130
- expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
131
- yield userEvent.click(screen.getByText("I updated your account with those settings. You're ready to set up your first dashboard!"));
132
- expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
133
- expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
134
- }));
135
- it('should handle isClicked prop within group of buttons correctly', () => __awaiter(void 0, void 0, void 0, function* () {
136
- render(_jsx(ResponseActions, { actions: {
137
- positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: true },
138
- negative: { 'data-testid': 'negative-btn', onClick: jest.fn() }
139
- } }));
140
- expect(screen.getByTestId('positive-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
141
- expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
142
- }));
143
- it('should set "listen" button as active if its `isClicked` is true', () => __awaiter(void 0, void 0, void 0, function* () {
144
- render(_jsx(ResponseActions, { actions: {
145
- positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: false },
146
- negative: { 'data-testid': 'negative-btn', onClick: jest.fn(), isClicked: false },
147
- listen: { 'data-testid': 'listen-btn', onClick: jest.fn(), isClicked: true }
148
- } }));
149
- expect(screen.getByTestId('listen-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
150
- expect(screen.getByTestId('positive-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
151
- expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
152
- }));
153
- it('should prioritize "positive" when both "positive" and "negative" are set to clicked', () => __awaiter(void 0, void 0, void 0, function* () {
154
- render(_jsx(ResponseActions, { actions: {
155
- positive: { 'data-testid': 'positive-btn', onClick: jest.fn(), isClicked: true },
156
- negative: { 'data-testid': 'negative-btn', onClick: jest.fn(), isClicked: true }
157
- } }));
158
- // Positive button should take precendence
159
- expect(screen.getByTestId('positive-btn')).toHaveClass('pf-chatbot__button--response-action-clicked');
160
- expect(screen.getByTestId('negative-btn')).not.toHaveClass('pf-chatbot__button--response-action-clicked');
161
- }));
162
- it('should set an additional action button as active if it is initially clicked and no predefined are clicked', () => __awaiter(void 0, void 0, void 0, function* () {
163
- const [additionalActions] = CUSTOM_ACTIONS;
164
- const customActions = Object.assign({ positive: { 'data-testid': 'positive', onClick: jest.fn(), isClicked: false }, negative: { 'data-testid': 'negative', onClick: jest.fn(), isClicked: false } }, Object.keys(additionalActions).reduce((acc, actionKey) => {
165
- acc[actionKey] = Object.assign(Object.assign({}, additionalActions[actionKey]), { 'data-testid': actionKey, isClicked: actionKey === 'regenerate' });
166
- return acc;
167
- }, {}));
168
- render(_jsx(ResponseActions, { actions: customActions }));
169
- Object.keys(customActions).forEach((actionKey) => {
170
- if (actionKey === 'regenerate') {
171
- expect(screen.getByTestId(actionKey)).toHaveClass('pf-chatbot__button--response-action-clicked');
172
- }
173
- else {
174
- // Other actions should not have clicked class
175
- expect(screen.getByTestId(actionKey)).not.toHaveClass('pf-chatbot__button--response-action-clicked');
176
- }
177
- });
178
- }));
179
- it('should activate the clicked button and deactivate any previously active button', () => __awaiter(void 0, void 0, void 0, function* () {
180
- const actions = {
181
- positive: { 'data-testid': 'positive', onClick: jest.fn(), isClicked: false },
182
- negative: { 'data-testid': 'negative', onClick: jest.fn(), isClicked: true }
183
- };
184
- render(_jsx(ResponseActions, { actions: actions }));
185
- const negativeBtn = screen.getByTestId('negative');
186
- const positiveBtn = screen.getByTestId('positive');
187
- // negative button is initially clicked
188
- expect(negativeBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
189
- expect(positiveBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
190
- yield userEvent.click(positiveBtn);
191
- // positive button should now have the clicked class
192
- expect(positiveBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
193
- expect(negativeBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
194
- }));
195
- it('should render buttons correctly', () => {
196
- ALL_ACTIONS.forEach(({ type, label }) => {
197
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
198
- expect(screen.getByRole('button', { name: label })).toBeTruthy();
199
- });
200
- });
201
- it('should be able to call onClick correctly', () => __awaiter(void 0, void 0, void 0, function* () {
202
- for (const { type, label } of ALL_ACTIONS) {
203
- const spy = jest.fn();
204
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: spy } } }));
205
- yield userEvent.click(screen.getByRole('button', { name: label }));
206
- expect(spy).toHaveBeenCalledTimes(1);
207
- }
208
- }));
209
- it('should swap clicked and non-clicked aria labels on click', () => __awaiter(void 0, void 0, void 0, function* () {
210
- for (const { type, label, clickedLabel } of ALL_ACTIONS) {
211
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
212
- expect(screen.getByRole('button', { name: label })).toBeTruthy();
213
- yield userEvent.click(screen.getByRole('button', { name: label }));
214
- expect(screen.getByRole('button', { name: clickedLabel })).toBeTruthy();
215
- }
216
- }));
217
- it('should swap clicked and non-clicked tooltips on click', () => __awaiter(void 0, void 0, void 0, function* () {
218
- for (const { type, label, clickedLabel } of ALL_ACTIONS) {
219
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn() } } }));
220
- expect(screen.getByRole('button', { name: label })).toBeTruthy();
221
- yield userEvent.click(screen.getByRole('button', { name: label }));
222
- expect(screen.getByRole('tooltip', { name: clickedLabel })).toBeTruthy();
223
- }
224
- }));
225
- it('should be able to change aria labels', () => {
226
- const actions = [
227
- { type: 'positive', ariaLabel: 'Thumbs up' },
228
- { type: 'negative', ariaLabel: 'Thumbs down' },
229
- { type: 'copy', ariaLabel: 'Copy the message' },
230
- { type: 'edit', ariaLabel: 'Edit this message' },
231
- { type: 'share', ariaLabel: 'Share it with friends' },
232
- { type: 'download', ariaLabel: 'Download your cool message' },
233
- { type: 'listen', ariaLabel: 'Listen up' }
234
- ];
235
- actions.forEach(({ type, ariaLabel }) => {
236
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), ariaLabel } } }));
237
- expect(screen.getByRole('button', { name: ariaLabel })).toBeTruthy();
238
- });
239
- });
240
- it('should be able to disable buttons', () => {
241
- ALL_ACTIONS.forEach(({ type, label }) => {
242
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), isDisabled: true } } }));
243
- expect(screen.getByRole('button', { name: label })).toBeDisabled();
244
- });
245
- });
246
- it('should be able to add class to buttons', () => {
247
- ALL_ACTIONS.forEach(({ type, label }) => {
248
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), className: 'test' } } }));
249
- expect(screen.getByRole('button', { name: label })).toHaveClass('test');
250
- });
251
- });
252
- it('should be able to add custom attributes to buttons', () => {
253
- ALL_ACTIONS_DATA_TEST.forEach(({ type, dataTestId }) => {
254
- render(_jsx(ResponseActions, { actions: { [type]: { onClick: jest.fn(), 'data-testid': dataTestId } } }));
255
- expect(screen.getByTestId(dataTestId)).toBeTruthy();
256
- });
257
- });
258
- it('should be able to add custom actions', () => {
259
- CUSTOM_ACTIONS.forEach((action) => {
260
- const key = Object.keys(action)[0];
261
- render(_jsx(ResponseActions, { actions: {
262
- [key]: {
263
- tooltipContent: action[key].tooltipContent,
264
- onClick: action[key].onClick,
265
- // doing this just because it's easier to test without a regex for the button name
266
- ariaLabel: action[key].ariaLabel.toLowerCase(),
267
- icon: action[key].icon,
268
- 'data-testid': action[key]
269
- }
270
- } }));
271
- expect(screen.getByRole('button', { name: key })).toBeTruthy();
272
- expect(screen.getByTestId(action[key])).toBeTruthy();
273
- });
274
- });
275
- // we are testing for the reverse case already above
276
- it('should not deselect when clicking outside when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
277
- render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
278
- positive: {},
279
- negative: {}
280
- }, persistActionSelection: true }));
281
- const goodBtn = screen.getByRole('button', { name: 'Good response' });
282
- yield userEvent.click(goodBtn);
283
- expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
284
- yield userEvent.click(screen.getByText('Test content'));
285
- expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass('pf-chatbot__button--response-action-clicked');
286
- }));
287
- it('should switch selection to another button when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
288
- render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
289
- positive: {},
290
- negative: {}
291
- }, persistActionSelection: true }));
292
- const goodBtn = screen.getByRole('button', { name: 'Good response' });
293
- const badBtn = screen.getByRole('button', { name: 'Bad response' });
294
- yield userEvent.click(goodBtn);
295
- expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
296
- yield userEvent.click(badBtn);
297
- expect(badBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
298
- expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
299
- }));
300
- it('should toggle off when clicking the same button when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
301
- render(_jsx(Message, { name: "Bot", role: "bot", avatar: "", content: "Test content", actions: {
302
- positive: {},
303
- negative: {}
304
- }, persistActionSelection: true }));
305
- const goodBtn = screen.getByRole('button', { name: 'Good response' });
306
- yield userEvent.click(goodBtn);
307
- expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
308
- yield userEvent.click(goodBtn);
309
- expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
310
- }));
311
- it('should work with custom actions when persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
312
- const actions = {
313
- positive: { 'data-testid': 'positive', onClick: jest.fn() },
314
- negative: { 'data-testid': 'negative', onClick: jest.fn() },
315
- custom: {
316
- 'data-testid': 'custom',
317
- onClick: jest.fn(),
318
- ariaLabel: 'Custom',
319
- tooltipContent: 'Custom action',
320
- icon: _jsx(RhUiExportIcon, {})
321
- }
322
- };
323
- render(_jsx(ResponseActions, { actions: actions, persistActionSelection: true }));
324
- const customBtn = screen.getByTestId('custom');
325
- yield userEvent.click(customBtn);
326
- expect(customBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
327
- yield userEvent.click(customBtn);
328
- expect(customBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
329
- }));
330
- it('should apply pf-m-visible-interaction class when showActionsOnInteraction is true', () => {
331
- render(_jsx(ResponseActions, { "data-testid": "test-id", actions: {
332
- positive: { onClick: jest.fn() },
333
- negative: { onClick: jest.fn() }
334
- }, showActionsOnInteraction: true }));
335
- expect(screen.getByTestId('test-id')).toHaveClass('pf-m-visible-interaction');
336
- });
337
- it('should not apply pf-m-visible-interaction class when showActionsOnInteraction is false', () => {
338
- render(_jsx(ResponseActions, { "data-testid": "test-id", actions: {
339
- positive: { onClick: jest.fn() },
340
- negative: { onClick: jest.fn() }
341
- }, showActionsOnInteraction: false }));
342
- expect(screen.getByTestId('test-id')).not.toHaveClass('pf-m-visible-interaction');
343
- });
344
- it('should not apply pf-m-visible-interaction class by default', () => {
345
- render(_jsx(ResponseActions, { "data-testid": "test-id", actions: {
346
- positive: { onClick: jest.fn() },
347
- negative: { onClick: jest.fn() }
348
- } }));
349
- expect(screen.getByTestId('test-id')).not.toHaveClass('pf-m-visible-interaction');
350
- });
351
- it('should render with custom className', () => {
352
- render(_jsx(ResponseActions, { "data-testid": "test-id", actions: {
353
- positive: { onClick: jest.fn() },
354
- negative: { onClick: jest.fn() }
355
- }, className: "custom-class" }));
356
- expect(screen.getByTestId('test-id')).toHaveClass('custom-class');
357
- });
358
- describe('icon swapping with useFilledIconsOnClick', () => {
359
- it('should render outline icons by default', () => {
360
- render(_jsx(ResponseActions, { actions: {
361
- positive: { onClick: jest.fn() },
362
- negative: { onClick: jest.fn() }
363
- } }));
364
- expect(screen.getByText('RhUiLikeIcon')).toBeInTheDocument();
365
- expect(screen.getByText('RhUiDislikeIcon')).toBeInTheDocument();
366
- expect(screen.queryByText('RhUiLikeFillIcon')).not.toBeInTheDocument();
367
- expect(screen.queryByText('RhUiDislikeFillIcon')).not.toBeInTheDocument();
368
- });
369
- describe('positive actions', () => {
370
- it('should not swap positive icon when clicked and useFilledIconsOnClick is false', () => __awaiter(void 0, void 0, void 0, function* () {
371
- const user = userEvent.setup();
372
- render(_jsx(ResponseActions, { actions: {
373
- positive: { onClick: jest.fn() }
374
- }, useFilledIconsOnClick: false }));
375
- yield user.click(screen.getByRole('button', { name: 'Good response' }));
376
- expect(screen.getByText('RhUiLikeIcon')).toBeInTheDocument();
377
- expect(screen.queryByText('RhUiLikeFillIcon')).not.toBeInTheDocument();
378
- }));
379
- it('should swap positive icon from outline to filled when clicked with useFilledIconsOnClick', () => __awaiter(void 0, void 0, void 0, function* () {
380
- const user = userEvent.setup();
381
- render(_jsx(ResponseActions, { actions: {
382
- positive: { onClick: jest.fn() }
383
- }, useFilledIconsOnClick: true }));
384
- yield user.click(screen.getByRole('button', { name: 'Good response' }));
385
- expect(screen.getByText('RhUiLikeFillIcon')).toBeInTheDocument();
386
- expect(screen.queryByText('RhUiLikeIcon')).not.toBeInTheDocument();
387
- }));
388
- it('should revert positive icon to outline icon when clicking outside', () => __awaiter(void 0, void 0, void 0, function* () {
389
- const user = userEvent.setup();
390
- render(_jsxs("div", { children: [_jsx(ResponseActions, { actions: {
391
- positive: { onClick: jest.fn() }
392
- }, useFilledIconsOnClick: true }), _jsx("div", { "data-testid": "outside", children: "Outside" })] }));
393
- yield user.click(screen.getByRole('button', { name: 'Good response' }));
394
- expect(screen.getByText('RhUiLikeFillIcon')).toBeInTheDocument();
395
- yield user.click(screen.getByTestId('outside'));
396
- expect(screen.getByText('RhUiLikeIcon')).toBeInTheDocument();
397
- }));
398
- it('should not revert positive icon to outline icon when clicking outside if persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
399
- const user = userEvent.setup();
400
- render(_jsxs("div", { children: [_jsx(ResponseActions, { actions: {
401
- positive: { onClick: jest.fn() }
402
- }, persistActionSelection: true, useFilledIconsOnClick: true }), _jsx("div", { "data-testid": "outside", children: "Outside" })] }));
403
- yield user.click(screen.getByRole('button', { name: 'Good response' }));
404
- expect(screen.getByText('RhUiLikeFillIcon')).toBeInTheDocument();
405
- yield user.click(screen.getByTestId('outside'));
406
- expect(screen.getByText('RhUiLikeFillIcon')).toBeInTheDocument();
407
- }));
408
- describe('negative actions', () => {
409
- it('should not swap negative icon when clicked and useFilledIconsOnClick is false', () => __awaiter(void 0, void 0, void 0, function* () {
410
- const user = userEvent.setup();
411
- render(_jsx(ResponseActions, { actions: {
412
- negative: { onClick: jest.fn() }
413
- }, useFilledIconsOnClick: false }));
414
- yield user.click(screen.getByRole('button', { name: 'Bad response' }));
415
- expect(screen.getByText('RhUiDislikeIcon')).toBeInTheDocument();
416
- expect(screen.queryByText('RhUiDislikeFillIcon')).not.toBeInTheDocument();
417
- }));
418
- it('should swap negative icon from outline to filled when clicked with useFilledIconsOnClick', () => __awaiter(void 0, void 0, void 0, function* () {
419
- const user = userEvent.setup();
420
- render(_jsx(ResponseActions, { actions: {
421
- negative: { onClick: jest.fn() }
422
- }, useFilledIconsOnClick: true }));
423
- yield user.click(screen.getByRole('button', { name: 'Bad response' }));
424
- expect(screen.getByText('RhUiDislikeFillIcon')).toBeInTheDocument();
425
- expect(screen.queryByText('RhUiDislikeIcon')).not.toBeInTheDocument();
426
- }));
427
- it('should revert negative icon to outline when clicking outside', () => __awaiter(void 0, void 0, void 0, function* () {
428
- const user = userEvent.setup();
429
- render(_jsxs("div", { children: [_jsx(ResponseActions, { actions: {
430
- negative: { onClick: jest.fn() }
431
- }, useFilledIconsOnClick: true }), _jsx("div", { "data-testid": "outside", children: "Outside" })] }));
432
- yield user.click(screen.getByRole('button', { name: 'Bad response' }));
433
- expect(screen.getByText('RhUiDislikeFillIcon')).toBeInTheDocument();
434
- yield user.click(screen.getByTestId('outside'));
435
- expect(screen.getByText('RhUiDislikeIcon')).toBeInTheDocument();
436
- }));
437
- it('should not revert negative icon to outline icon when clicking outside if persistActionSelection is true', () => __awaiter(void 0, void 0, void 0, function* () {
438
- const user = userEvent.setup();
439
- render(_jsxs("div", { children: [_jsx(ResponseActions, { actions: {
440
- negative: { onClick: jest.fn() }
441
- }, persistActionSelection: true, useFilledIconsOnClick: true }), _jsx("div", { "data-testid": "outside", children: "Outside" })] }));
442
- yield user.click(screen.getByRole('button', { name: 'Bad response' }));
443
- expect(screen.getByText('RhUiDislikeFillIcon')).toBeInTheDocument();
444
- yield user.click(screen.getByTestId('outside'));
445
- expect(screen.getByText('RhUiDislikeFillIcon')).toBeInTheDocument();
446
- }));
447
- });
448
- });
449
- });
450
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,20 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import ResponseActionsGroups from './ResponseActionsGroups';
5
- test('Renders with children', () => {
6
- render(_jsx(ResponseActionsGroups, { children: "Test content" }));
7
- expect(screen.getByText('Test content')).toBeInTheDocument();
8
- });
9
- test('Renders with pf-chatbot__response-actions-groups class by default', () => {
10
- render(_jsx(ResponseActionsGroups, { children: "Test content" }));
11
- expect(screen.getByText('Test content')).toHaveClass('pf-chatbot__response-actions-groups', { exact: true });
12
- });
13
- test('Renders with custom className', () => {
14
- render(_jsx(ResponseActionsGroups, { className: "custom-class", children: "Test content" }));
15
- expect(screen.getByText('Test content')).toHaveClass('custom-class');
16
- });
17
- test('Spreads additional props', () => {
18
- render(_jsx(ResponseActionsGroups, { id: "test-id", children: "Test content" }));
19
- expect(screen.getByText('Test content')).toHaveAttribute('id', 'test-id');
20
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from '@patternfly/react-core';
3
- import { render, screen } from '@testing-library/react';
4
- import { SettingsForm } from './SettingsForm';
5
- import '@testing-library/jest-dom';
6
- describe('SettingsForm', () => {
7
- it('should render settingsForm with custom classname', () => {
8
- const { container } = render(_jsx(SettingsForm, { className: "custom-settings" }));
9
- expect(container.querySelector('.custom-settings')).toBeTruthy();
10
- });
11
- it('should render settingsForm with fields', () => {
12
- const fields = [
13
- {
14
- id: 'archived-chat',
15
- label: 'Archive chat',
16
- field: (_jsx(Button, { id: "archived-chat", variant: "secondary", children: "Archive chat" }))
17
- }
18
- ];
19
- render(_jsx(SettingsForm, { fields: fields }));
20
- expect(screen.getByRole('button', { name: 'Archive chat' })).toBeTruthy();
21
- });
22
- it('should render settingsForm with isCompact', () => {
23
- const fields = [
24
- {
25
- id: 'archived-chat',
26
- label: 'Archive chat',
27
- field: (_jsx(Button, { id: "archived-chat", variant: "secondary", children: "Archive chat" }))
28
- }
29
- ];
30
- render(_jsx(SettingsForm, { "data-testid": "settings-form", fields: fields, isCompact: true }));
31
- expect(screen.getByTestId('settings-form')).toHaveClass('pf-m-compact');
32
- });
33
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import '@testing-library/jest-dom';
4
- import SourcesCard from './SourcesCard';
5
- describe('SourcesCard', () => {
6
- it('should render sources correctly if one source is passed in', () => {
7
- render(_jsx(SourcesCard, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
8
- expect(screen.getByText('1 source')).toBeTruthy();
9
- expect(screen.getByText('How to make an apple pie')).toBeTruthy();
10
- });
11
- it('should render sources correctly when there is more than one', () => {
12
- render(_jsx(SourcesCard, { sources: [
13
- { title: 'How to make an apple pie', link: '' },
14
- { title: 'How to make cookies', link: '' }
15
- ] }));
16
- expect(screen.getByText('2 sources')).toBeTruthy();
17
- expect(screen.getByText('How to make an apple pie')).toBeTruthy();
18
- expect(screen.getByText('1/2')).toBeTruthy();
19
- screen.getByRole('button', { name: /Go to previous page/i });
20
- screen.getByRole('button', { name: /Go to next page/i });
21
- });
22
- it('should render with wrap layout when layout is set to wrap', () => {
23
- render(_jsx(SourcesCard, { layout: "wrap", sources: [
24
- { title: 'How to make an apple pie', link: '' },
25
- { title: 'How to make cookies', link: '' },
26
- { title: 'How to make a sandwich', link: '' }
27
- ] }));
28
- expect(screen.getByText('How to make an apple pie')).toBeVisible();
29
- expect(screen.getByText('How to make cookies')).toBeVisible();
30
- expect(screen.getByText('How to make a sandwich')).toBeVisible();
31
- expect(screen.queryByRole('navigation')).not.toBeInTheDocument();
32
- expect(screen.queryByText('1/3')).not.toBeInTheDocument();
33
- });
34
- });
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';