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