@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.
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +125 -16
- 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.d.ts +2 -0
- package/dist/cjs/MessageBox/MessageBox.js +7 -2
- package/dist/cjs/index.d.ts +0 -8
- package/dist/cjs/index.js +1 -13
- package/dist/css/main.css +77 -10
- package/dist/css/main.css.map +1 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +46 -5
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +128 -19
- 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.d.ts +2 -0
- package/dist/esm/MessageBox/MessageBox.js +7 -2
- 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/examples/UI/ChatbotHeaderDrawerWithExpandableGroups.tsx +104 -0
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +12 -1
- 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/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.scss +52 -6
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +551 -3
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +350 -49
- package/src/ChatbotFooter/ChatbotFooter.scss +2 -2
- package/src/ChatbotHeader/ChatbotHeader.scss +4 -0
- package/src/ChatbotModal/ChatbotModal.scss +10 -0
- package/src/ChatbotToggle/ChatbotToggle.scss +6 -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.scss +5 -0
- package/src/Message/Message.test.tsx +5 -0
- package/src/Message/Message.tsx +3 -5
- package/src/MessageBox/MessageBox.scss +15 -1
- package/src/MessageBox/MessageBox.tsx +23 -2
- 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 -277
- 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 -272
- 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
|
@@ -1,192 +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 MarkdownContent_1 = __importDefault(require("./MarkdownContent"));
|
|
19
|
-
const rehype_external_links_1 = __importDefault(require("../__mocks__/rehype-external-links"));
|
|
20
|
-
const BOLD_TEXT = '**Bold text**';
|
|
21
|
-
const ITALIC_TEXT = '*Italic text*';
|
|
22
|
-
const INLINE_CODE = 'Here is inline code: `const x = 5`';
|
|
23
|
-
const CODE_BLOCK = `\`\`\`javascript
|
|
24
|
-
function hello() {
|
|
25
|
-
console.log('Hello, world!');
|
|
26
|
-
}
|
|
27
|
-
\`\`\``;
|
|
28
|
-
const HEADING = '# Heading 1';
|
|
29
|
-
const LINK = '[PatternFly](https://www.patternfly.org/)';
|
|
30
|
-
const UNORDERED_LIST = `
|
|
31
|
-
* Item 1
|
|
32
|
-
* Item 2
|
|
33
|
-
* Item 3
|
|
34
|
-
`;
|
|
35
|
-
const ORDERED_LIST = `
|
|
36
|
-
1. First item
|
|
37
|
-
2. Second item
|
|
38
|
-
3. Third item
|
|
39
|
-
`;
|
|
40
|
-
const TABLE = `
|
|
41
|
-
| Column 1 | Column 2 |
|
|
42
|
-
|----------|----------|
|
|
43
|
-
| Cell 1 | Cell 2 |
|
|
44
|
-
| Cell 3 | Cell 4 |
|
|
45
|
-
`;
|
|
46
|
-
const BLOCKQUOTE = '> This is a blockquote';
|
|
47
|
-
const IMAGE = '';
|
|
48
|
-
describe('MarkdownContent', () => {
|
|
49
|
-
beforeEach(() => {
|
|
50
|
-
jest.clearAllMocks();
|
|
51
|
-
});
|
|
52
|
-
it('should render bold text correctly', () => {
|
|
53
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: BOLD_TEXT }));
|
|
54
|
-
expect(container.querySelector('strong')).toBeTruthy();
|
|
55
|
-
expect(react_1.screen.getByText('Bold text')).toBeTruthy();
|
|
56
|
-
});
|
|
57
|
-
it('should render italic text correctly', () => {
|
|
58
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: ITALIC_TEXT }));
|
|
59
|
-
expect(container.querySelector('em')).toBeTruthy();
|
|
60
|
-
expect(react_1.screen.getByText('Italic text')).toBeTruthy();
|
|
61
|
-
});
|
|
62
|
-
it('should render inline code correctly', () => {
|
|
63
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: INLINE_CODE }));
|
|
64
|
-
expect(react_1.screen.getByText(/const x = 5/)).toBeTruthy();
|
|
65
|
-
});
|
|
66
|
-
it('should render code blocks correctly', () => {
|
|
67
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: CODE_BLOCK }));
|
|
68
|
-
expect(react_1.screen.getByText(/function hello/)).toBeVisible();
|
|
69
|
-
expect(react_1.screen.getByText(/console.log/)).toBeVisible();
|
|
70
|
-
expect(react_1.screen.getByRole('button', { name: 'Copy code' })).toBeVisible();
|
|
71
|
-
});
|
|
72
|
-
it('should render headings correctly', () => {
|
|
73
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: HEADING }));
|
|
74
|
-
expect(react_1.screen.getByRole('heading', { name: /Heading 1/i })).toBeTruthy();
|
|
75
|
-
});
|
|
76
|
-
it('should render links correctly', () => {
|
|
77
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: LINK }));
|
|
78
|
-
expect(react_1.screen.getByRole('link', { name: /PatternFly/i })).toBeTruthy();
|
|
79
|
-
});
|
|
80
|
-
it('should render unordered lists correctly', () => {
|
|
81
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: UNORDERED_LIST }));
|
|
82
|
-
expect(react_1.screen.getByText('Item 1')).toBeTruthy();
|
|
83
|
-
expect(react_1.screen.getByText('Item 2')).toBeTruthy();
|
|
84
|
-
expect(react_1.screen.getByText('Item 3')).toBeTruthy();
|
|
85
|
-
expect(react_1.screen.getAllByRole('listitem')).toHaveLength(3);
|
|
86
|
-
});
|
|
87
|
-
it('should render ordered lists correctly', () => {
|
|
88
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: ORDERED_LIST }));
|
|
89
|
-
expect(react_1.screen.getByText('First item')).toBeTruthy();
|
|
90
|
-
expect(react_1.screen.getByText('Second item')).toBeTruthy();
|
|
91
|
-
expect(react_1.screen.getByText('Third item')).toBeTruthy();
|
|
92
|
-
expect(react_1.screen.getAllByRole('listitem')).toHaveLength(3);
|
|
93
|
-
});
|
|
94
|
-
it('should render tables correctly', () => {
|
|
95
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: TABLE, tableProps: { 'aria-label': 'Test table' } }));
|
|
96
|
-
expect(react_1.screen.getByRole('grid', { name: /Test table/i })).toBeTruthy();
|
|
97
|
-
expect(react_1.screen.getByRole('columnheader', { name: /Column 1/i })).toBeTruthy();
|
|
98
|
-
expect(react_1.screen.getByRole('columnheader', { name: /Column 2/i })).toBeTruthy();
|
|
99
|
-
expect(react_1.screen.getByRole('cell', { name: /Cell 1/i })).toBeTruthy();
|
|
100
|
-
expect(react_1.screen.getByRole('cell', { name: /Cell 2/i })).toBeTruthy();
|
|
101
|
-
});
|
|
102
|
-
it('should render blockquotes correctly', () => {
|
|
103
|
-
var _a;
|
|
104
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: BLOCKQUOTE }));
|
|
105
|
-
const quote = react_1.screen.getByText(/This is a blockquote/);
|
|
106
|
-
expect(quote).toBeVisible();
|
|
107
|
-
expect((_a = quote.closest('.pf-v6-c-content--blockquote')) === null || _a === void 0 ? void 0 : _a.tagName).toBe('BLOCKQUOTE');
|
|
108
|
-
});
|
|
109
|
-
it('should render images when hasNoImages is false', () => {
|
|
110
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: IMAGE, hasNoImages: false }));
|
|
111
|
-
expect(react_1.screen.getByRole('img', { name: /Alt text/i })).toBeTruthy();
|
|
112
|
-
});
|
|
113
|
-
it('should not render images when hasNoImages is true', () => {
|
|
114
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: IMAGE, hasNoImages: true }));
|
|
115
|
-
expect(react_1.screen.queryByRole('img', { name: /Alt text/i })).toBeFalsy();
|
|
116
|
-
});
|
|
117
|
-
it('should disable markdown rendering when isMarkdownDisabled is true', () => {
|
|
118
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: BOLD_TEXT, isMarkdownDisabled: true }));
|
|
119
|
-
expect(react_1.screen.getByText('**Bold text**')).toBeTruthy();
|
|
120
|
-
});
|
|
121
|
-
it('should render text component when isMarkdownDisabled is true and textComponent is provided', () => {
|
|
122
|
-
const textComponent = (0, jsx_runtime_1.jsx)("div", { "data-testid": "custom-text", children: "Custom text component" });
|
|
123
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: BOLD_TEXT, isMarkdownDisabled: true, textComponent: textComponent }));
|
|
124
|
-
expect(react_1.screen.getByTestId('custom-text')).toBeTruthy();
|
|
125
|
-
expect(react_1.screen.getByText('Custom text component')).toBeTruthy();
|
|
126
|
-
});
|
|
127
|
-
it('should apply isPrimary prop to elements', () => {
|
|
128
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: INLINE_CODE, isPrimary: true }));
|
|
129
|
-
expect(container.querySelector('.pf-m-primary')).toBeTruthy();
|
|
130
|
-
});
|
|
131
|
-
it('should apply shouldRetainStyles prop to elements', () => {
|
|
132
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: BOLD_TEXT, shouldRetainStyles: true }));
|
|
133
|
-
expect(container.querySelector('.pf-m-markdown')).toBeTruthy();
|
|
134
|
-
});
|
|
135
|
-
it('should pass codeBlockProps to code blocks', () => {
|
|
136
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: CODE_BLOCK, codeBlockProps: { 'aria-label': 'Custom code block' } }));
|
|
137
|
-
expect(react_1.screen.getByRole('button', { name: /Custom code block/i })).toBeTruthy();
|
|
138
|
-
});
|
|
139
|
-
it('should pass tableProps to tables', () => {
|
|
140
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: TABLE, tableProps: { 'aria-label': 'Custom table label' } }));
|
|
141
|
-
expect(react_1.screen.getByRole('grid', { name: /Custom table label/i })).toBeTruthy();
|
|
142
|
-
});
|
|
143
|
-
it('should open links in new tab when openLinkInNewTab is true', () => {
|
|
144
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: LINK, openLinkInNewTab: true }));
|
|
145
|
-
expect(rehype_external_links_1.default).toHaveBeenCalledTimes(1);
|
|
146
|
-
});
|
|
147
|
-
it('should not open links in new tab when openLinkInNewTab is false', () => {
|
|
148
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: LINK, openLinkInNewTab: false }));
|
|
149
|
-
expect(rehype_external_links_1.default).not.toHaveBeenCalled();
|
|
150
|
-
});
|
|
151
|
-
it('should pass linkProps to links', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
152
|
-
const onClick = jest.fn();
|
|
153
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: LINK, linkProps: { onClick } }));
|
|
154
|
-
const link = react_1.screen.getByRole('link', { name: /PatternFly/i });
|
|
155
|
-
link.click();
|
|
156
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
157
|
-
}));
|
|
158
|
-
it('should handle reactMarkdownProps.disallowedElements', () => {
|
|
159
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: CODE_BLOCK, reactMarkdownProps: { disallowedElements: ['code'] } }));
|
|
160
|
-
// Code block should not render when disallowed
|
|
161
|
-
expect(react_1.screen.queryByRole('button', { name: /Copy code/i })).toBeFalsy();
|
|
162
|
-
});
|
|
163
|
-
it('should render plain text when no markdown is present', () => {
|
|
164
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: "Plain text without markdown" }));
|
|
165
|
-
expect(react_1.screen.getByText('Plain text without markdown')).toBeTruthy();
|
|
166
|
-
});
|
|
167
|
-
it('should handle empty content', () => {
|
|
168
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: "" }));
|
|
169
|
-
expect(container.textContent).toBe('');
|
|
170
|
-
});
|
|
171
|
-
it('should handle undefined content', () => {
|
|
172
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, {}));
|
|
173
|
-
expect(container.textContent).toBe('');
|
|
174
|
-
});
|
|
175
|
-
it('should render multiple markdown elements together', () => {
|
|
176
|
-
const content = `# Heading
|
|
177
|
-
|
|
178
|
-
**Bold text** and *italic text*
|
|
179
|
-
|
|
180
|
-
\`\`\`javascript
|
|
181
|
-
const x = 5;
|
|
182
|
-
\`\`\`
|
|
183
|
-
|
|
184
|
-
[Link](https://example.com)`;
|
|
185
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(MarkdownContent_1.default, { content: content }));
|
|
186
|
-
expect(react_1.screen.getByRole('heading', { name: /Heading/i })).toBeTruthy();
|
|
187
|
-
expect(react_1.screen.getByText('Bold text')).toBeTruthy();
|
|
188
|
-
expect(react_1.screen.getByText('italic text')).toBeTruthy();
|
|
189
|
-
expect(react_1.screen.getByText(/const x = 5/)).toBeTruthy();
|
|
190
|
-
expect(react_1.screen.getByRole('link', { name: /Link/i })).toBeTruthy();
|
|
191
|
-
});
|
|
192
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,131 +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_1 = require("@testing-library/react");
|
|
18
|
-
const user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
19
|
-
const CodeBlockMessage_1 = __importDefault(require("./CodeBlockMessage"));
|
|
20
|
-
// Mock clipboard API
|
|
21
|
-
Object.assign(navigator, {
|
|
22
|
-
clipboard: {
|
|
23
|
-
writeText: jest.fn()
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
describe('CodeBlockMessage', () => {
|
|
27
|
-
beforeEach(() => {
|
|
28
|
-
jest.clearAllMocks();
|
|
29
|
-
});
|
|
30
|
-
it('should render inline code for single-line content', () => {
|
|
31
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { className: "language-javascript", children: "const x = 5;" }));
|
|
32
|
-
const code = react_1.screen.getByText('const x = 5;');
|
|
33
|
-
expect(code.tagName).toBe('CODE');
|
|
34
|
-
expect(code).toHaveClass('pf-chatbot__message-inline-code');
|
|
35
|
-
});
|
|
36
|
-
it('should render code block for multi-line content', () => {
|
|
37
|
-
const multilineCode = 'const x = 5;\nconst y = 10;';
|
|
38
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { className: "language-javascript", children: multilineCode }));
|
|
39
|
-
const codeElement = container.querySelector('code');
|
|
40
|
-
expect(codeElement === null || codeElement === void 0 ? void 0 : codeElement.textContent).toBe(multilineCode);
|
|
41
|
-
});
|
|
42
|
-
it('should display language label', () => {
|
|
43
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
44
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { className: "language-javascript", children: code }));
|
|
45
|
-
expect(react_1.screen.getByText('javascript')).toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
it('should render copy button', () => {
|
|
48
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
49
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { children: code }));
|
|
50
|
-
expect(react_1.screen.getByRole('button', { name: 'Copy code' })).toBeInTheDocument();
|
|
51
|
-
});
|
|
52
|
-
it('should copy plain string content to clipboard', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
54
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { children: code }));
|
|
55
|
-
const copyButton = react_1.screen.getByRole('button', { name: 'Copy code' });
|
|
56
|
-
yield user_event_1.default.click(copyButton);
|
|
57
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(code);
|
|
58
|
-
}));
|
|
59
|
-
it('should extract text content from React elements when copying', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
// Simulate what happens with syntax highlighting - children become React elements
|
|
61
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsxs)(CodeBlockMessage_1.default, { className: "language-javascript", children: [(0, jsx_runtime_1.jsx)("span", { className: "hljs-keyword", children: "const" }), " x = 5;", '\n', (0, jsx_runtime_1.jsx)("span", { className: "hljs-keyword", children: "const" }), " y = 10;"] }));
|
|
62
|
-
const copyButton = react_1.screen.getByRole('button', { name: 'Copy code' });
|
|
63
|
-
yield user_event_1.default.click(copyButton);
|
|
64
|
-
// Should extract actual text content from DOM, not "[object Object]"
|
|
65
|
-
const codeElement = container.querySelector('code');
|
|
66
|
-
const expectedText = (codeElement === null || codeElement === void 0 ? void 0 : codeElement.textContent) || '';
|
|
67
|
-
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(expectedText);
|
|
68
|
-
expect(expectedText).not.toContain('[object Object]');
|
|
69
|
-
}));
|
|
70
|
-
it('should show check icon after copying', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
72
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { children: code }));
|
|
73
|
-
const copyButton = react_1.screen.getByRole('button', { name: 'Copy code' });
|
|
74
|
-
yield user_event_1.default.click(copyButton);
|
|
75
|
-
// Check icon should be visible (we can verify by checking if CopyIcon is not present)
|
|
76
|
-
const svgElement = copyButton.querySelector('svg');
|
|
77
|
-
expect(svgElement).toBeInTheDocument();
|
|
78
|
-
}));
|
|
79
|
-
it('should render expandable section when isExpandable is true', () => {
|
|
80
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
81
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isExpandable: true, children: code }));
|
|
82
|
-
expect(react_1.screen.getByRole('button', { name: 'Show more' })).toBeInTheDocument();
|
|
83
|
-
});
|
|
84
|
-
it('should toggle expandable section', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
86
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isExpandable: true, children: code }));
|
|
87
|
-
const toggleButton = react_1.screen.getByRole('button', { name: 'Show more' });
|
|
88
|
-
yield user_event_1.default.click(toggleButton);
|
|
89
|
-
expect(react_1.screen.getByRole('button', { name: 'Show less' })).toBeInTheDocument();
|
|
90
|
-
}));
|
|
91
|
-
it('should use custom expanded/collapsed text', () => {
|
|
92
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
93
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isExpandable: true, expandedText: "Hide", collapsedText: "Reveal", children: code }));
|
|
94
|
-
expect(react_1.screen.getByRole('button', { name: 'Reveal' })).toBeInTheDocument();
|
|
95
|
-
});
|
|
96
|
-
it('should pass through expandableSectionProps', () => {
|
|
97
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
98
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isExpandable: true, expandableSectionProps: { className: 'custom-expandable-class' }, children: code }));
|
|
99
|
-
const expandableSection = container.querySelector('.pf-v6-c-expandable-section.custom-expandable-class');
|
|
100
|
-
expect(expandableSection).toBeInTheDocument();
|
|
101
|
-
});
|
|
102
|
-
it('should render custom actions', () => {
|
|
103
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
104
|
-
const customAction = (0, jsx_runtime_1.jsx)("button", { "aria-label": "Custom action", children: "Custom" });
|
|
105
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { customActions: customAction, children: code }));
|
|
106
|
-
expect(react_1.screen.getByRole('button', { name: 'Custom action' })).toBeInTheDocument();
|
|
107
|
-
});
|
|
108
|
-
it('should apply isPrimary class to inline code', () => {
|
|
109
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isPrimary: true, children: "const x = 5;" }));
|
|
110
|
-
const code = react_1.screen.getByText('const x = 5;');
|
|
111
|
-
expect(code).toHaveClass('pf-m-primary');
|
|
112
|
-
});
|
|
113
|
-
it('should apply shouldRetainStyles class to code block', () => {
|
|
114
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
115
|
-
const { container } = (0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { shouldRetainStyles: true, children: code }));
|
|
116
|
-
const codeBlockDiv = container.querySelector('.pf-chatbot__message-code-block');
|
|
117
|
-
expect(codeBlockDiv).toHaveClass('pf-m-markdown');
|
|
118
|
-
});
|
|
119
|
-
it('should use custom aria-label for copy button', () => {
|
|
120
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
121
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { "aria-label": "Copy this code", children: code }));
|
|
122
|
-
expect(react_1.screen.getByRole('button', { name: 'Copy this code' })).toBeInTheDocument();
|
|
123
|
-
});
|
|
124
|
-
it('should prioritize data-expanded-text over expandedText prop', () => {
|
|
125
|
-
const code = 'const x = 5;\nconst y = 10;';
|
|
126
|
-
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(jest.fn());
|
|
127
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(CodeBlockMessage_1.default, { isExpandable: true, expandedText: "Custom Expanded", "data-expanded-text": "Data Expanded", children: code }));
|
|
128
|
-
expect(consoleErrorSpy).toHaveBeenCalledWith('Message:', expect.stringContaining('data-expanded-text or data-collapsed-text will override'));
|
|
129
|
-
consoleErrorSpy.mockRestore();
|
|
130
|
-
});
|
|
131
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,30 +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 ErrorMessage_1 = __importDefault(require("./ErrorMessage"));
|
|
10
|
-
test('Renders with title', () => {
|
|
11
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { title: "Error occurred" }));
|
|
12
|
-
expect(react_1.screen.getByText('Error occurred')).toBeVisible();
|
|
13
|
-
});
|
|
14
|
-
test('Renders with children', () => {
|
|
15
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { title: "Error occurred", children: "This is the error message body" }));
|
|
16
|
-
expect(react_1.screen.getByText('This is the error message body')).toBeVisible();
|
|
17
|
-
});
|
|
18
|
-
test('Renders with action links', () => {
|
|
19
|
-
const actionLinks = ((0, jsx_runtime_1.jsx)("a", { href: "#retry", "data-testid": "retry-link", children: "Retry action link" }));
|
|
20
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { title: "Error occurred", actionLinks: actionLinks }));
|
|
21
|
-
expect(react_1.screen.getByText('Retry action link')).toBeVisible();
|
|
22
|
-
});
|
|
23
|
-
test('Renders with custom className', () => {
|
|
24
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { title: "Error occurred", className: "custom-error-class" }));
|
|
25
|
-
expect(react_1.screen.getByText('Error occurred').parentElement).toHaveClass('custom-error-class');
|
|
26
|
-
});
|
|
27
|
-
test('Renders with spread props', () => {
|
|
28
|
-
(0, react_1.render)((0, jsx_runtime_1.jsx)(ErrorMessage_1.default, { title: "Error occurred", id: "test-error-id" }));
|
|
29
|
-
expect(react_1.screen.getByText('Error occurred').parentElement).toHaveAttribute('id', 'test-error-id');
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|