@patternfly/chatbot 6.8.0-prerelease.8 → 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.
- package/dist/cjs/CodeModal/CodeModal.js +5 -0
- package/dist/cjs/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/cjs/MarkdownContent/MarkdownContent.js +79 -166
- package/dist/cjs/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/cjs/MarkdownContent/MarkdownRenderer.js +187 -0
- package/dist/cjs/Message/Message.d.ts +3 -4
- package/dist/cjs/Message/Message.js +0 -2
- package/dist/cjs/MessageBox/MessageBox.js +5 -1
- package/dist/cjs/index.d.ts +0 -8
- package/dist/cjs/index.js +1 -13
- package/dist/css/main.css +18 -3
- package/dist/css/main.css.map +1 -1
- package/dist/esm/CodeModal/CodeModal.js +5 -0
- package/dist/esm/MarkdownContent/MarkdownContent.d.ts +26 -7
- package/dist/esm/MarkdownContent/MarkdownContent.js +52 -165
- package/dist/esm/MarkdownContent/MarkdownRenderer.d.ts +6 -0
- package/dist/esm/MarkdownContent/MarkdownRenderer.js +182 -0
- package/dist/esm/Message/Message.d.ts +3 -4
- package/dist/esm/Message/Message.js +0 -2
- package/dist/esm/MessageBox/MessageBox.js +5 -1
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.js +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/generate-index.js +41 -16
- package/generate-index.test.js +68 -0
- package/monaco-environment.js +45 -0
- package/package.json +20 -2
- package/patternfly-docs/content/extensions/chatbot/chatbot.md +1 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickStart.tsx +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +2 -2
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/monitor-sampleapp-quickstart.ts +1 -0
- package/patternfly-docs/content/extensions/chatbot/tree-shaking.md +124 -0
- package/patternfly-docs/monaco-environment.js +45 -0
- package/patternfly-docs/patternfly-docs.css.js +6 -0
- package/src/Chatbot/Chatbot.scss +4 -0
- package/src/ChatbotContent/ChatbotContent.scss +1 -1
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
- package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +10 -0
- package/src/CodeModal/CodeModal.tsx +6 -0
- package/src/DeepThinking/DeepThinking.test.tsx +10 -12
- package/src/MarkdownContent/MarkdownContent.test.tsx +52 -5
- package/src/MarkdownContent/MarkdownContent.tsx +77 -220
- package/src/MarkdownContent/MarkdownRenderer.tsx +235 -0
- package/src/Message/Message.test.tsx +5 -0
- package/src/Message/Message.tsx +3 -5
- package/src/MessageBox/MessageBox.tsx +13 -1
- package/src/ResponseActions/ResponseActions.test.tsx +42 -48
- package/src/ToolCall/ToolCall.test.tsx +6 -9
- package/src/ToolResponse/ToolResponse.test.tsx +16 -22
- package/src/index.ts +0 -12
- package/src/test-utils/markdownTestUtils.ts +21 -0
- package/tsconfig.json +6 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/cjs/AttachmentEdit/AttachmentEdit.test.js +0 -77
- package/dist/cjs/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/cjs/Chatbot/Chatbot.test.js +0 -32
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/cjs/ChatbotAlert/ChatbotAlert.test.js +0 -27
- package/dist/cjs/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/cjs/ChatbotContent/ChatbotContent.test.js +0 -22
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -75
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -601
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooter.test.js +0 -27
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/cjs/ChatbotFooter/ChatbotFooternote.test.js +0 -87
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeader.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderActions.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMain.test.js +0 -18
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -22
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -46
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -44
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/cjs/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -55
- package/dist/cjs/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/cjs/ChatbotModal/ChatbotModal.test.js +0 -16
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/cjs/ChatbotToggle/ChatbotToggle.test.js +0 -64
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/cjs/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -61
- package/dist/cjs/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/cjs/CodeModal/CodeModal.test.js +0 -34
- package/dist/cjs/Compare/Compare.test.d.ts +0 -1
- package/dist/cjs/Compare/Compare.test.js +0 -18
- package/dist/cjs/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/cjs/DeepThinking/DeepThinking.test.js +0 -146
- package/dist/cjs/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/cjs/FileDetails/FileDetails.test.js +0 -42
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/cjs/FileDetailsLabel/FileDetailsLabel.test.js +0 -79
- package/dist/cjs/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/cjs/FileDropZone/FileDropZone.test.js +0 -100
- package/dist/cjs/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/cjs/FilePreview/FilePreview.test.js +0 -97
- package/dist/cjs/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/cjs/ImagePreview/ImagePreview.test.js +0 -225
- package/dist/cjs/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/cjs/MarkdownContent/MarkdownContent.test.js +0 -192
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/cjs/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -131
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/cjs/Message/ErrorMessage/ErrorMessage.test.js +0 -30
- package/dist/cjs/Message/Message.test.d.ts +0 -1
- package/dist/cjs/Message/Message.test.js +0 -1128
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAndActions/MessageAndActions.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -25
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/cjs/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -25
- package/dist/cjs/Message/MessageLoading.test.d.ts +0 -1
- package/dist/cjs/Message/MessageLoading.test.js +0 -25
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/cjs/Message/QuickResponse/QuickResponse.test.js +0 -109
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/cjs/Message/QuickStarts/QuickStartTileDescription.test.js +0 -76
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedback.test.js +0 -181
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/cjs/Message/UserFeedback/UserFeedbackComplete.test.js +0 -243
- package/dist/cjs/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/AttachButton.test.js +0 -152
- package/dist/cjs/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/cjs/MessageBar/MessageBar.test.js +0 -338
- package/dist/cjs/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/SendButton.test.js +0 -58
- package/dist/cjs/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/cjs/MessageBar/StopButton.test.js +0 -58
- package/dist/cjs/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +0 -39
- package/dist/cjs/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/cjs/MessageBox/MessageBox.test.js +0 -294
- package/dist/cjs/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/cjs/MessageDivider/MessageDivider.test.js +0 -29
- package/dist/cjs/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/cjs/Onboarding/Onboarding.test.js +0 -80
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/cjs/PreviewAttachment/PreviewAttachment.test.js +0 -50
- package/dist/cjs/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionButton.test.js +0 -54
- package/dist/cjs/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActions.test.js +0 -455
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/cjs/ResponseActions/ResponseActionsGroups.test.js +0 -25
- package/dist/cjs/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/cjs/Settings/SettingsForm.test.js +0 -35
- package/dist/cjs/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/cjs/SourcesCard/SourcesCard.test.js +0 -39
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/cjs/SourcesCardBase/SourcesCardBase.test.js +0 -199
- package/dist/cjs/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/cjs/TermsOfUse/TermsOfUse.test.js +0 -77
- package/dist/cjs/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/cjs/ToolCall/ToolCall.test.js +0 -201
- package/dist/cjs/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/cjs/ToolResponse/ToolResponse.test.js +0 -184
- package/dist/cjs/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/cjs/__mocks__/monaco-editor.js +0 -18
- package/dist/cjs/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-external-links.js +0 -4
- package/dist/cjs/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-highlight.js +0 -4
- package/dist/cjs/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-sanitize.js +0 -4
- package/dist/cjs/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/cjs/__mocks__/rehype-unwrap-images.js +0 -4
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.d.ts +0 -1
- package/dist/esm/AttachmentEdit/AttachmentEdit.test.js +0 -72
- package/dist/esm/Chatbot/Chatbot.test.d.ts +0 -1
- package/dist/esm/Chatbot/Chatbot.test.js +0 -27
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.d.ts +0 -1
- package/dist/esm/ChatbotAlert/ChatbotAlert.test.js +0 -22
- package/dist/esm/ChatbotContent/ChatbotContent.test.d.ts +0 -1
- package/dist/esm/ChatbotContent/ChatbotContent.test.js +0 -17
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryDropdown.test.js +0 -70
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.d.ts +0 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +0 -596
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooter.test.js +0 -22
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.d.ts +0 -1
- package/dist/esm/ChatbotFooter/ChatbotFooternote.test.js +0 -82
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeader.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderActions.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderCloseButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMain.test.js +0 -13
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderMenu.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderNewChatButton.test.js +0 -20
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderOptionsDropdown.test.js +0 -44
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderSelectorDropdown.test.js +0 -42
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.d.ts +0 -1
- package/dist/esm/ChatbotHeader/ChatbotHeaderTitle.test.js +0 -50
- package/dist/esm/ChatbotModal/ChatbotModal.test.d.ts +0 -1
- package/dist/esm/ChatbotModal/ChatbotModal.test.js +0 -11
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.d.ts +0 -1
- package/dist/esm/ChatbotToggle/ChatbotToggle.test.js +0 -59
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.d.ts +0 -1
- package/dist/esm/ChatbotWelcomePrompt/ChatbotWelcomePrompt.test.js +0 -56
- package/dist/esm/CodeModal/CodeModal.test.d.ts +0 -1
- package/dist/esm/CodeModal/CodeModal.test.js +0 -29
- package/dist/esm/Compare/Compare.test.d.ts +0 -1
- package/dist/esm/Compare/Compare.test.js +0 -13
- package/dist/esm/DeepThinking/DeepThinking.test.d.ts +0 -1
- package/dist/esm/DeepThinking/DeepThinking.test.js +0 -141
- package/dist/esm/FileDetails/FileDetails.test.d.ts +0 -1
- package/dist/esm/FileDetails/FileDetails.test.js +0 -37
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.d.ts +0 -1
- package/dist/esm/FileDetailsLabel/FileDetailsLabel.test.js +0 -74
- package/dist/esm/FileDropZone/FileDropZone.test.d.ts +0 -1
- package/dist/esm/FileDropZone/FileDropZone.test.js +0 -95
- package/dist/esm/FilePreview/FilePreview.test.d.ts +0 -1
- package/dist/esm/FilePreview/FilePreview.test.js +0 -92
- package/dist/esm/ImagePreview/ImagePreview.test.d.ts +0 -1
- package/dist/esm/ImagePreview/ImagePreview.test.js +0 -220
- package/dist/esm/MarkdownContent/MarkdownContent.test.d.ts +0 -1
- package/dist/esm/MarkdownContent/MarkdownContent.test.js +0 -187
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.d.ts +0 -1
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.test.js +0 -126
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.d.ts +0 -1
- package/dist/esm/Message/ErrorMessage/ErrorMessage.test.js +0 -25
- package/dist/esm/Message/Message.test.d.ts +0 -1
- package/dist/esm/Message/Message.test.js +0 -1123
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.d.ts +0 -1
- package/dist/esm/Message/MessageAndActions/MessageAndActions.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentItem.test.js +0 -20
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.d.ts +0 -1
- package/dist/esm/Message/MessageAttachments/MessageAttachmentsContainer.test.js +0 -20
- package/dist/esm/Message/MessageLoading.test.d.ts +0 -1
- package/dist/esm/Message/MessageLoading.test.js +0 -20
- package/dist/esm/Message/QuickResponse/QuickResponse.test.d.ts +0 -1
- package/dist/esm/Message/QuickResponse/QuickResponse.test.js +0 -104
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.d.ts +0 -1
- package/dist/esm/Message/QuickStarts/QuickStartTileDescription.test.js +0 -48
- package/dist/esm/Message/UserFeedback/UserFeedback.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedback.test.js +0 -176
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.d.ts +0 -1
- package/dist/esm/Message/UserFeedback/UserFeedbackComplete.test.js +0 -238
- package/dist/esm/MessageBar/AttachButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/AttachButton.test.js +0 -147
- package/dist/esm/MessageBar/MessageBar.test.d.ts +0 -1
- package/dist/esm/MessageBar/MessageBar.test.js +0 -333
- package/dist/esm/MessageBar/SendButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/SendButton.test.js +0 -53
- package/dist/esm/MessageBar/StopButton.test.d.ts +0 -1
- package/dist/esm/MessageBar/StopButton.test.js +0 -53
- package/dist/esm/MessageBox/JumpButton.test.d.ts +0 -1
- package/dist/esm/MessageBox/JumpButton.test.js +0 -34
- package/dist/esm/MessageBox/MessageBox.test.d.ts +0 -1
- package/dist/esm/MessageBox/MessageBox.test.js +0 -289
- package/dist/esm/MessageDivider/MessageDivider.test.d.ts +0 -1
- package/dist/esm/MessageDivider/MessageDivider.test.js +0 -24
- package/dist/esm/Onboarding/Onboarding.test.d.ts +0 -1
- package/dist/esm/Onboarding/Onboarding.test.js +0 -75
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.d.ts +0 -1
- package/dist/esm/PreviewAttachment/PreviewAttachment.test.js +0 -48
- package/dist/esm/ResponseActions/ResponseActionButton.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionButton.test.js +0 -49
- package/dist/esm/ResponseActions/ResponseActions.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActions.test.js +0 -450
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.d.ts +0 -1
- package/dist/esm/ResponseActions/ResponseActionsGroups.test.js +0 -20
- package/dist/esm/Settings/SettingsForm.test.d.ts +0 -1
- package/dist/esm/Settings/SettingsForm.test.js +0 -33
- package/dist/esm/SourcesCard/SourcesCard.test.d.ts +0 -1
- package/dist/esm/SourcesCard/SourcesCard.test.js +0 -34
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.d.ts +0 -1
- package/dist/esm/SourcesCardBase/SourcesCardBase.test.js +0 -194
- package/dist/esm/TermsOfUse/TermsOfUse.test.d.ts +0 -1
- package/dist/esm/TermsOfUse/TermsOfUse.test.js +0 -72
- package/dist/esm/ToolCall/ToolCall.test.d.ts +0 -1
- package/dist/esm/ToolCall/ToolCall.test.js +0 -196
- package/dist/esm/ToolResponse/ToolResponse.test.d.ts +0 -1
- package/dist/esm/ToolResponse/ToolResponse.test.js +0 -179
- package/dist/esm/__mocks__/monaco-editor.d.ts +0 -11
- package/dist/esm/__mocks__/monaco-editor.js +0 -18
- package/dist/esm/__mocks__/rehype-external-links.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-external-links.js +0 -2
- package/dist/esm/__mocks__/rehype-highlight.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-highlight.js +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-sanitize.js +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.d.ts +0 -2
- package/dist/esm/__mocks__/rehype-unwrap-images.js +0 -2
|
@@ -3,7 +3,6 @@ import '@testing-library/jest-dom';
|
|
|
3
3
|
import ResponseActions, { ActionProps } from './ResponseActions';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
import { RhUiExportIcon, RhMicronsInformationFillIcon, RhUiRedoIcon } from '@patternfly/react-icons';
|
|
6
|
-
import Message from '../Message';
|
|
7
6
|
|
|
8
7
|
// Mock the icon components
|
|
9
8
|
jest.mock('@patternfly/react-icons', () => ({
|
|
@@ -116,18 +115,16 @@ describe('ResponseActions', () => {
|
|
|
116
115
|
});
|
|
117
116
|
});
|
|
118
117
|
it('should handle click outside of group of buttons correctly', async () => {
|
|
119
|
-
// using message just so we have something outside the group that's rendered
|
|
120
118
|
render(
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
/>
|
|
119
|
+
<div>
|
|
120
|
+
<ResponseActions
|
|
121
|
+
actions={{
|
|
122
|
+
positive: { onClick: jest.fn() },
|
|
123
|
+
negative: { onClick: jest.fn() }
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
<div data-testid="outside">Outside</div>
|
|
127
|
+
</div>
|
|
131
128
|
);
|
|
132
129
|
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
133
130
|
const badBtn = screen.getByRole('button', { name: 'Bad response' });
|
|
@@ -145,9 +142,8 @@ describe('ResponseActions', () => {
|
|
|
145
142
|
'pf-chatbot__button--response-action-clicked'
|
|
146
143
|
);
|
|
147
144
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
);
|
|
145
|
+
|
|
146
|
+
await userEvent.click(screen.getByTestId('outside'));
|
|
151
147
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
152
148
|
expect(badBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
153
149
|
});
|
|
@@ -343,27 +339,28 @@ describe('ResponseActions', () => {
|
|
|
343
339
|
|
|
344
340
|
// we are testing for the reverse case already above
|
|
345
341
|
it('should not deselect when clicking outside when persistActionSelection is true', async () => {
|
|
342
|
+
const user = userEvent.setup();
|
|
343
|
+
|
|
346
344
|
render(
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
/>
|
|
345
|
+
<div>
|
|
346
|
+
<ResponseActions
|
|
347
|
+
actions={{
|
|
348
|
+
positive: { onClick: jest.fn() },
|
|
349
|
+
negative: { onClick: jest.fn() }
|
|
350
|
+
}}
|
|
351
|
+
persistActionSelection
|
|
352
|
+
/>
|
|
353
|
+
<div data-testid="outside">Outside</div>
|
|
354
|
+
</div>
|
|
358
355
|
);
|
|
359
356
|
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
360
357
|
|
|
361
|
-
await
|
|
358
|
+
await user.click(goodBtn);
|
|
362
359
|
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass(
|
|
363
360
|
'pf-chatbot__button--response-action-clicked'
|
|
364
361
|
);
|
|
365
362
|
|
|
366
|
-
await
|
|
363
|
+
await user.click(screen.getByTestId('outside'));
|
|
367
364
|
|
|
368
365
|
expect(screen.getByRole('button', { name: 'Good response recorded' })).toHaveClass(
|
|
369
366
|
'pf-chatbot__button--response-action-clicked'
|
|
@@ -371,15 +368,13 @@ describe('ResponseActions', () => {
|
|
|
371
368
|
});
|
|
372
369
|
|
|
373
370
|
it('should switch selection to another button when persistActionSelection is true', async () => {
|
|
371
|
+
const user = userEvent.setup();
|
|
372
|
+
|
|
374
373
|
render(
|
|
375
|
-
<
|
|
376
|
-
name="Bot"
|
|
377
|
-
role="bot"
|
|
378
|
-
avatar=""
|
|
379
|
-
content="Test content"
|
|
374
|
+
<ResponseActions
|
|
380
375
|
actions={{
|
|
381
|
-
positive: {},
|
|
382
|
-
negative: {}
|
|
376
|
+
positive: { onClick: jest.fn() },
|
|
377
|
+
negative: { onClick: jest.fn() }
|
|
383
378
|
}}
|
|
384
379
|
persistActionSelection
|
|
385
380
|
/>
|
|
@@ -387,38 +382,37 @@ describe('ResponseActions', () => {
|
|
|
387
382
|
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
388
383
|
const badBtn = screen.getByRole('button', { name: 'Bad response' });
|
|
389
384
|
|
|
390
|
-
await
|
|
385
|
+
await user.click(goodBtn);
|
|
391
386
|
expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
392
387
|
|
|
393
|
-
await
|
|
388
|
+
await user.click(badBtn);
|
|
394
389
|
expect(badBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
395
390
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
396
391
|
});
|
|
397
392
|
|
|
398
393
|
it('should toggle off when clicking the same button when persistActionSelection is true', async () => {
|
|
394
|
+
const user = userEvent.setup();
|
|
395
|
+
|
|
399
396
|
render(
|
|
400
|
-
<
|
|
401
|
-
name="Bot"
|
|
402
|
-
role="bot"
|
|
403
|
-
avatar=""
|
|
404
|
-
content="Test content"
|
|
397
|
+
<ResponseActions
|
|
405
398
|
actions={{
|
|
406
|
-
positive: {},
|
|
407
|
-
negative: {}
|
|
399
|
+
positive: { onClick: jest.fn() },
|
|
400
|
+
negative: { onClick: jest.fn() }
|
|
408
401
|
}}
|
|
409
402
|
persistActionSelection
|
|
410
403
|
/>
|
|
411
404
|
);
|
|
412
405
|
const goodBtn = screen.getByRole('button', { name: 'Good response' });
|
|
413
406
|
|
|
414
|
-
await
|
|
407
|
+
await user.click(goodBtn);
|
|
415
408
|
expect(goodBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
416
409
|
|
|
417
|
-
await
|
|
410
|
+
await user.click(goodBtn);
|
|
418
411
|
expect(goodBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
419
412
|
});
|
|
420
413
|
|
|
421
414
|
it('should work with custom actions when persistActionSelection is true', async () => {
|
|
415
|
+
const user = userEvent.setup();
|
|
422
416
|
const actions = {
|
|
423
417
|
positive: { 'data-testid': 'positive', onClick: jest.fn() },
|
|
424
418
|
negative: { 'data-testid': 'negative', onClick: jest.fn() },
|
|
@@ -433,10 +427,10 @@ describe('ResponseActions', () => {
|
|
|
433
427
|
render(<ResponseActions actions={actions} persistActionSelection />);
|
|
434
428
|
|
|
435
429
|
const customBtn = screen.getByTestId('custom');
|
|
436
|
-
await
|
|
430
|
+
await user.click(customBtn);
|
|
437
431
|
expect(customBtn).toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
438
432
|
|
|
439
|
-
await
|
|
433
|
+
await user.click(customBtn);
|
|
440
434
|
expect(customBtn).not.toHaveClass('pf-chatbot__button--response-action-clicked');
|
|
441
435
|
});
|
|
442
436
|
|
|
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
import ToolCall from './ToolCall';
|
|
5
|
+
import { expectBoldMarkdownText } from '../test-utils/markdownTestUtils';
|
|
5
6
|
|
|
6
7
|
describe('ToolCall', () => {
|
|
7
8
|
const defaultProps = {
|
|
@@ -233,11 +234,10 @@ describe('ToolCall', () => {
|
|
|
233
234
|
expect(screen.queryByText('Expandable Content')).not.toBeVisible();
|
|
234
235
|
});
|
|
235
236
|
|
|
236
|
-
it('should render titleText as markdown when isTitleMarkdown is true', () => {
|
|
237
|
+
it('should render titleText as markdown when isTitleMarkdown is true', async () => {
|
|
237
238
|
const titleText = '**Bold title**';
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
expect(screen.getByText('Bold title')).toBeTruthy();
|
|
239
|
+
render(<ToolCall titleText={titleText} isTitleMarkdown />);
|
|
240
|
+
await expectBoldMarkdownText('Bold title');
|
|
241
241
|
});
|
|
242
242
|
|
|
243
243
|
it('should not render titleText as markdown when isTitleMarkdown is false', () => {
|
|
@@ -249,12 +249,9 @@ describe('ToolCall', () => {
|
|
|
249
249
|
it('should render expandableContent as markdown when isExpandableContentMarkdown is true', async () => {
|
|
250
250
|
const user = userEvent.setup();
|
|
251
251
|
const expandableContent = '**Bold expandable content**';
|
|
252
|
-
|
|
253
|
-
<ToolCall {...defaultProps} expandableContent={expandableContent} isExpandableContentMarkdown />
|
|
254
|
-
);
|
|
252
|
+
render(<ToolCall {...defaultProps} expandableContent={expandableContent} isExpandableContentMarkdown />);
|
|
255
253
|
await user.click(screen.getByRole('button', { name: defaultProps.titleText }));
|
|
256
|
-
|
|
257
|
-
expect(screen.getByText('Bold expandable content')).toBeTruthy();
|
|
254
|
+
await expectBoldMarkdownText('Bold expandable content');
|
|
258
255
|
});
|
|
259
256
|
|
|
260
257
|
it('should not render expandableContent as markdown when isExpandableContentMarkdown is false', async () => {
|
|
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
3
|
import '@testing-library/jest-dom';
|
|
4
4
|
import ToolResponse from './ToolResponse';
|
|
5
|
+
import { expectBoldMarkdownText } from '../test-utils/markdownTestUtils';
|
|
5
6
|
|
|
6
7
|
describe('ToolResponse', () => {
|
|
7
8
|
const defaultProps = {
|
|
@@ -150,13 +151,10 @@ describe('ToolResponse', () => {
|
|
|
150
151
|
expect(screen.getByText(defaultProps.cardBody)).not.toBeVisible();
|
|
151
152
|
});
|
|
152
153
|
|
|
153
|
-
it('should render toggleContent as markdown when isToggleContentMarkdown is true', () => {
|
|
154
|
+
it('should render toggleContent as markdown when isToggleContentMarkdown is true', async () => {
|
|
154
155
|
const toggleContent = '**Bold toggle**';
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
);
|
|
158
|
-
expect(container.querySelector('strong')).toBeTruthy();
|
|
159
|
-
expect(screen.getByText('Bold toggle')).toBeTruthy();
|
|
156
|
+
render(<ToolResponse {...defaultProps} toggleContent={toggleContent} isToggleContentMarkdown />);
|
|
157
|
+
await expectBoldMarkdownText('Bold toggle');
|
|
160
158
|
});
|
|
161
159
|
|
|
162
160
|
it('should not render toggleContent as markdown when isToggleContentMarkdown is false', () => {
|
|
@@ -165,11 +163,10 @@ describe('ToolResponse', () => {
|
|
|
165
163
|
expect(screen.getByText('**Bold toggle**')).toBeTruthy();
|
|
166
164
|
});
|
|
167
165
|
|
|
168
|
-
it('should render subheading as markdown when isSubheadingMarkdown is true', () => {
|
|
166
|
+
it('should render subheading as markdown when isSubheadingMarkdown is true', async () => {
|
|
169
167
|
const subheading = '**Bold subheading**';
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
expect(screen.getByText('Bold subheading')).toBeTruthy();
|
|
168
|
+
render(<ToolResponse {...defaultProps} subheading={subheading} isSubheadingMarkdown />);
|
|
169
|
+
await expectBoldMarkdownText('Bold subheading');
|
|
173
170
|
});
|
|
174
171
|
|
|
175
172
|
it('should not render subheading as markdown when isSubheadingMarkdown is false', () => {
|
|
@@ -178,11 +175,10 @@ describe('ToolResponse', () => {
|
|
|
178
175
|
expect(screen.getByText('**Bold subheading**')).toBeTruthy();
|
|
179
176
|
});
|
|
180
177
|
|
|
181
|
-
it('should render body as markdown when isBodyMarkdown is true', () => {
|
|
178
|
+
it('should render body as markdown when isBodyMarkdown is true', async () => {
|
|
182
179
|
const body = '**Bold body**';
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
expect(screen.getByText('Bold body')).toBeTruthy();
|
|
180
|
+
render(<ToolResponse {...defaultProps} body={body} isBodyMarkdown />);
|
|
181
|
+
await expectBoldMarkdownText('Bold body');
|
|
186
182
|
});
|
|
187
183
|
|
|
188
184
|
it('should not render body as markdown when isBodyMarkdown is false', () => {
|
|
@@ -191,11 +187,10 @@ describe('ToolResponse', () => {
|
|
|
191
187
|
expect(screen.getByText('**Bold body**')).toBeTruthy();
|
|
192
188
|
});
|
|
193
189
|
|
|
194
|
-
it('should render cardTitle as markdown when isCardTitleMarkdown is true', () => {
|
|
190
|
+
it('should render cardTitle as markdown when isCardTitleMarkdown is true', async () => {
|
|
195
191
|
const cardTitle = '**Bold card title**';
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
expect(screen.getByText('Bold card title')).toBeTruthy();
|
|
192
|
+
render(<ToolResponse {...defaultProps} cardTitle={cardTitle} isCardTitleMarkdown />);
|
|
193
|
+
await expectBoldMarkdownText('Bold card title');
|
|
199
194
|
});
|
|
200
195
|
|
|
201
196
|
it('should not render cardTitle as markdown when isCardTitleMarkdown is false', () => {
|
|
@@ -204,11 +199,10 @@ describe('ToolResponse', () => {
|
|
|
204
199
|
expect(screen.getByText('**Bold card title**')).toBeTruthy();
|
|
205
200
|
});
|
|
206
201
|
|
|
207
|
-
it('should render cardBody as markdown when isCardBodyMarkdown is true', () => {
|
|
202
|
+
it('should render cardBody as markdown when isCardBodyMarkdown is true', async () => {
|
|
208
203
|
const cardBody = '**Bold card body**';
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
expect(screen.getByText('Bold card body')).toBeTruthy();
|
|
204
|
+
render(<ToolResponse {...defaultProps} cardBody={cardBody} isCardBodyMarkdown />);
|
|
205
|
+
await expectBoldMarkdownText('Bold card body');
|
|
212
206
|
});
|
|
213
207
|
|
|
214
208
|
it('should not render cardBody as markdown when isCardBodyMarkdown is false', () => {
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
// this file is autogenerated by generate-index.js, modifying it manually will have no effect
|
|
2
2
|
|
|
3
|
-
export { default as AttachmentEdit } from './AttachmentEdit';
|
|
4
|
-
export * from './AttachmentEdit';
|
|
5
|
-
|
|
6
3
|
export { default as AttachMenu } from './AttachMenu';
|
|
7
4
|
export * from './AttachMenu';
|
|
8
5
|
|
|
@@ -36,9 +33,6 @@ export * from './ChatbotToggle';
|
|
|
36
33
|
export { default as ChatbotWelcomePrompt } from './ChatbotWelcomePrompt';
|
|
37
34
|
export * from './ChatbotWelcomePrompt';
|
|
38
35
|
|
|
39
|
-
export { default as CodeModal } from './CodeModal';
|
|
40
|
-
export * from './CodeModal';
|
|
41
|
-
|
|
42
36
|
export { default as Compare } from './Compare';
|
|
43
37
|
export * from './Compare';
|
|
44
38
|
|
|
@@ -78,9 +72,6 @@ export * from './MessageDivider';
|
|
|
78
72
|
export { default as Onboarding } from './Onboarding';
|
|
79
73
|
export * from './Onboarding';
|
|
80
74
|
|
|
81
|
-
export { default as PreviewAttachment } from './PreviewAttachment';
|
|
82
|
-
export * from './PreviewAttachment';
|
|
83
|
-
|
|
84
75
|
export { default as ResponseActions } from './ResponseActions';
|
|
85
76
|
export * from './ResponseActions';
|
|
86
77
|
|
|
@@ -104,6 +95,3 @@ export * from './ToolCall';
|
|
|
104
95
|
|
|
105
96
|
export { default as ToolResponse } from './ToolResponse';
|
|
106
97
|
export * from './ToolResponse';
|
|
107
|
-
|
|
108
|
-
export { default as tracking } from './tracking';
|
|
109
|
-
export * from './tracking';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import MarkdownContent, {
|
|
4
|
+
preloadMarkdownRenderer,
|
|
5
|
+
whenMarkdownRendererReady
|
|
6
|
+
} from '../MarkdownContent/MarkdownContent';
|
|
7
|
+
|
|
8
|
+
/** Preloads and warms the lazy MarkdownRenderer so synchronous getByText assertions work. */
|
|
9
|
+
export async function warmupMarkdownRenderer() {
|
|
10
|
+
preloadMarkdownRenderer();
|
|
11
|
+
await whenMarkdownRendererReady();
|
|
12
|
+
const { unmount } = render(createElement(MarkdownContent, { content: '.' }));
|
|
13
|
+
await screen.findByText('.', {}, { timeout: 10000 });
|
|
14
|
+
unmount();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Waits for lazy-loaded markdown to render and asserts bold text. */
|
|
18
|
+
export async function expectBoldMarkdownText(text: string) {
|
|
19
|
+
const element = await screen.findByText(text, {}, { timeout: 10000 });
|
|
20
|
+
expect(element.closest('strong')).not.toBeNull();
|
|
21
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -69,5 +69,10 @@
|
|
|
69
69
|
"skipLibCheck": true /* Skip type checking of declaration files. */,
|
|
70
70
|
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
71
|
},
|
|
72
|
-
"include": ["./src/*", "./src/**/*", "./cypress/**/*"]
|
|
72
|
+
"include": ["./src/*", "./src/**/*", "./cypress/**/*"],
|
|
73
|
+
"exclude": [
|
|
74
|
+
"**/*.test.tsx",
|
|
75
|
+
"**/__mocks__/**",
|
|
76
|
+
"**/test-utils/**"
|
|
77
|
+
]
|
|
73
78
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,77 +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 AttachmentEdit_1 = __importDefault(require("./AttachmentEdit"));
|
|
19
|
-
describe('AttachmentEdit', () => {
|
|
20
|
-
it('should open AttachmentEdit modal', () => {
|
|
21
|
-
const props = {
|
|
22
|
-
code: 'code',
|
|
23
|
-
fileName: 'fileName',
|
|
24
|
-
onCancel: jest.fn(),
|
|
25
|
-
onSave: jest.fn(),
|
|
26
|
-
isModalOpen: true,
|
|
27
|
-
handleModalToggle: jest.fn()
|
|
28
|
-
};
|
|
29
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(AttachmentEdit_1.default, Object.assign({}, props)));
|
|
30
|
-
expect(react_1.screen.getByText('Edit attachment')).toBeTruthy();
|
|
31
|
-
});
|
|
32
|
-
it('should call onSave handler when the save button is clicked', () => {
|
|
33
|
-
const onSaveHandler = jest.fn();
|
|
34
|
-
const props = {
|
|
35
|
-
code: 'code',
|
|
36
|
-
fileName: 'fileName',
|
|
37
|
-
onCancel: jest.fn(),
|
|
38
|
-
onSave: onSaveHandler,
|
|
39
|
-
isModalOpen: true,
|
|
40
|
-
handleModalToggle: jest.fn()
|
|
41
|
-
};
|
|
42
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(AttachmentEdit_1.default, Object.assign({}, props)));
|
|
43
|
-
// Click on save button
|
|
44
|
-
react_1.fireEvent.click(react_1.screen.getByText('Save'));
|
|
45
|
-
expect(onSaveHandler).toHaveBeenCalledWith(expect.any(Object), 'code');
|
|
46
|
-
});
|
|
47
|
-
it('should call cancel handler when the cancel button is clicked', () => {
|
|
48
|
-
const onCancelHandler = jest.fn();
|
|
49
|
-
const props = {
|
|
50
|
-
code: 'code',
|
|
51
|
-
fileName: 'fileName',
|
|
52
|
-
onCancel: onCancelHandler,
|
|
53
|
-
onSave: jest.fn(),
|
|
54
|
-
isModalOpen: true,
|
|
55
|
-
handleModalToggle: jest.fn()
|
|
56
|
-
};
|
|
57
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(AttachmentEdit_1.default, Object.assign({}, props)));
|
|
58
|
-
// Click on cancel button
|
|
59
|
-
react_1.fireEvent.click(react_1.screen.getByText('Cancel'));
|
|
60
|
-
expect(onCancelHandler).toHaveBeenCalled();
|
|
61
|
-
});
|
|
62
|
-
it('should render custom button text for footer actions buttons', () => {
|
|
63
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(AttachmentEdit_1.default, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onCancel: jest.fn(), onSave: jest.fn(), handleModalToggle: jest.fn(), primaryActionButtonText: "Save", secondaryActionButtonText: "Close" }));
|
|
64
|
-
expect(react_1.screen.getByText('Save')).toBeInTheDocument();
|
|
65
|
-
expect(react_1.screen.getByText('Close')).toBeInTheDocument();
|
|
66
|
-
});
|
|
67
|
-
it('should render AttachmentEdit with custom classNames', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(AttachmentEdit_1.default, { code: "Hello world", fileName: "greetings.txt", isModalOpen: true, onCancel: jest.fn(), onSave: jest.fn(), handleModalToggle: jest.fn(), primaryActionButtonText: "Save", secondaryActionButtonText: "Close", modalHeaderClassName: "custom-header-class", modalBodyClassName: "custom-body-class", modalFooterClassName: "custom-footer-class" }));
|
|
69
|
-
const modal = react_1.screen.getByRole('dialog');
|
|
70
|
-
const modalHeader = (0, react_1.within)(modal).getByRole('banner');
|
|
71
|
-
expect(modalHeader).toHaveClass('custom-header-class');
|
|
72
|
-
const modalBody = modal.querySelector('#code-modal-body');
|
|
73
|
-
expect(modalBody).toHaveClass('custom-body-class');
|
|
74
|
-
const modalfooter = (0, react_1.within)(modal).getByRole('contentinfo');
|
|
75
|
-
expect(modalfooter).toHaveClass('custom-footer-class');
|
|
76
|
-
}));
|
|
77
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,32 +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 Chatbot_1 = __importDefault(require("./Chatbot"));
|
|
10
|
-
describe('Chatbot', () => {
|
|
11
|
-
it('should render Chatbot with default display mode', () => {
|
|
12
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(Chatbot_1.default, { children: "Chatbot Content" }));
|
|
13
|
-
expect(react_1.screen.getByText('Chatbot Content')).toBeTruthy();
|
|
14
|
-
});
|
|
15
|
-
it('should render Chatbot with custom ariaLabel', () => {
|
|
16
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(Chatbot_1.default, { ariaLabel: "Chatbot", children: "Chatbot Content" }));
|
|
17
|
-
expect(react_1.screen.getByLabelText('Chatbot')).toBeTruthy();
|
|
18
|
-
});
|
|
19
|
-
it('should render Chatbot with custom className', () => {
|
|
20
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(Chatbot_1.default, { ariaLabel: "Chatbot", className: "custom-class", children: "Chatbot Content" }));
|
|
21
|
-
const chatbotElement = container.querySelector('.custom-class');
|
|
22
|
-
expect(chatbotElement).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
it('should not render Chatbot', () => {
|
|
25
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(Chatbot_1.default, { isVisible: false, children: "Chatbot Content" }));
|
|
26
|
-
expect(react_1.screen.queryByLabelText('Chatbot')).toBeFalsy();
|
|
27
|
-
});
|
|
28
|
-
it('should handle isCompact', () => {
|
|
29
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(Chatbot_1.default, { "data-testid": "chatbot", isVisible: true, isCompact: true, children: "Chatbot Content" }));
|
|
30
|
-
expect(react_1.screen.getByTestId('chatbot')).toHaveClass('pf-m-compact');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,27 +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
|
-
const ChatbotAlert_1 = __importDefault(require("./ChatbotAlert"));
|
|
9
|
-
describe('ChatbotAlert', () => {
|
|
10
|
-
it('should render ChatbotAlert with default variant', () => {
|
|
11
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotAlert_1.default, { title: "Chatbot Alert" }));
|
|
12
|
-
expect(react_1.screen.getByText('Chatbot Alert')).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
it('should render ChatbotAlert with children', () => {
|
|
15
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotAlert_1.default, { title: "Chatbot Alert", children: "Chatbot Alert Content" }));
|
|
16
|
-
expect(react_1.screen.getByText('Chatbot Alert Content')).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
it('should call onClose handler when onClose button is clicked', () => {
|
|
19
|
-
const onCloseHandler = jest.fn();
|
|
20
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotAlert_1.default, { title: "Chatbot Alert", onClose: onCloseHandler, children: "Chatbot Alert Content" }));
|
|
21
|
-
expect(react_1.screen.getByText('Chatbot Alert')).toBeTruthy();
|
|
22
|
-
expect(react_1.screen.getByText('Chatbot Alert Content')).toBeTruthy();
|
|
23
|
-
// click on the close button
|
|
24
|
-
react_1.fireEvent.click(react_1.screen.getByRole('button'));
|
|
25
|
-
expect(onCloseHandler).toHaveBeenCalled();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +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
|
-
const ChatbotContent_1 = __importDefault(require("./ChatbotContent"));
|
|
9
|
-
describe('ChatbotContent', () => {
|
|
10
|
-
it('should render ChatbotContent with children', () => {
|
|
11
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotContent_1.default, { children: "Chatbot Content" }));
|
|
12
|
-
expect(react_1.screen.getByText('Chatbot Content')).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
it('should render ChatbotContent with custom classname', () => {
|
|
15
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotContent_1.default, { className: "custom-class", children: "Chatbot Content" }));
|
|
16
|
-
expect(container.querySelector('.custom-class')).toBeTruthy();
|
|
17
|
-
});
|
|
18
|
-
it('should render ChatbotContent with primary class', () => {
|
|
19
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotContent_1.default, { isPrimary: true, children: "Chatbot Content" }));
|
|
20
|
-
expect(container.querySelector('.pf-m-primary')).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,75 +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
|
-
require("@testing-library/jest-dom");
|
|
17
|
-
const react_core_1 = require("@patternfly/react-core");
|
|
18
|
-
const react_1 = require("@testing-library/react");
|
|
19
|
-
const ChatbotConversationHistoryDropdown_1 = __importDefault(require("./ChatbotConversationHistoryDropdown"));
|
|
20
|
-
describe('ChatbotConversationHistoryDropdown', () => {
|
|
21
|
-
const onSelect = jest.fn();
|
|
22
|
-
const menuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_core_1.DropdownItem, { children: "Rename" }), (0, jsx_runtime_1.jsx)(react_core_1.DropdownItem, { children: "Delete" })] }));
|
|
23
|
-
it('should render the dropdown', () => {
|
|
24
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, menuClassName: "custom-class" }));
|
|
25
|
-
expect(react_1.screen.queryByRole('menuitem', { name: /Conversation options/i })).toBeInTheDocument();
|
|
26
|
-
});
|
|
27
|
-
it('should display the dropdown menuItems', () => {
|
|
28
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems }));
|
|
29
|
-
const toggle = react_1.screen.queryByRole('menuitem', { name: /Conversation options/i });
|
|
30
|
-
expect(toggle).toBeInTheDocument();
|
|
31
|
-
react_1.fireEvent.click(toggle);
|
|
32
|
-
(0, react_1.waitFor)(() => {
|
|
33
|
-
expect(react_1.screen.getByText('Rename')).toBeInTheDocument();
|
|
34
|
-
expect(react_1.screen.getByText('Delete')).toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
it('should invoke onSelect callback when menuitem is clicked', () => {
|
|
38
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, onSelect: onSelect }));
|
|
39
|
-
const toggle = react_1.screen.queryByRole('menuitem', { name: /Conversation options/i });
|
|
40
|
-
react_1.fireEvent.click(toggle);
|
|
41
|
-
react_1.fireEvent.click(react_1.screen.getByText('Rename'));
|
|
42
|
-
expect(onSelect).toHaveBeenCalled();
|
|
43
|
-
});
|
|
44
|
-
it('should toggle the dropdown when menuitem is clicked', () => {
|
|
45
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, onSelect: onSelect }));
|
|
46
|
-
const toggle = react_1.screen.queryByRole('menuitem', { name: /Conversation options/i });
|
|
47
|
-
react_1.fireEvent.click(toggle);
|
|
48
|
-
react_1.fireEvent.click(react_1.screen.getByText('Delete'));
|
|
49
|
-
expect(onSelect).toHaveBeenCalled();
|
|
50
|
-
expect(react_1.screen.queryByText('Delete')).not.toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
it('should close the dropdown when user clicks outside', () => {
|
|
53
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, onSelect: onSelect }));
|
|
54
|
-
const toggle = react_1.screen.queryByRole('menuitem', { name: /Conversation options/i });
|
|
55
|
-
react_1.fireEvent.click(toggle);
|
|
56
|
-
expect(react_1.screen.queryByText('Delete')).toBeInTheDocument();
|
|
57
|
-
react_1.fireEvent.click(toggle.parentElement);
|
|
58
|
-
expect(react_1.screen.queryByText('Delete')).not.toBeInTheDocument();
|
|
59
|
-
});
|
|
60
|
-
it('should show the tooltip when the user hovers over the toggle button', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, label: "Actions dropdown" }));
|
|
62
|
-
const toggle = react_1.screen.queryByRole('menuitem', { name: /Actions dropdown/i });
|
|
63
|
-
(0, react_1.fireEvent)(toggle, new MouseEvent('mouseenter', {
|
|
64
|
-
bubbles: false,
|
|
65
|
-
cancelable: false
|
|
66
|
-
}));
|
|
67
|
-
yield (0, react_1.waitFor)(() => {
|
|
68
|
-
expect(react_1.screen.queryByText('Actions dropdown')).toBeInTheDocument();
|
|
69
|
-
});
|
|
70
|
-
}));
|
|
71
|
-
it('should be able to set a custom aria-label', () => {
|
|
72
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ChatbotConversationHistoryDropdown_1.default, { menuItems: menuItems, "aria-label": "Custom conversation options" }));
|
|
73
|
-
expect(react_1.screen.queryByRole('menuitem', { name: /Custom conversation options/i })).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|