@patternfly/chatbot 6.8.0-prerelease.8 → 6.9.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { render, screen } from '@testing-library/react';
|
|
12
|
-
import userEvent from '@testing-library/user-event';
|
|
13
|
-
import '@testing-library/jest-dom';
|
|
14
|
-
import SourcesCardBase from './SourcesCardBase';
|
|
15
|
-
describe('SourcesCardBase', () => {
|
|
16
|
-
it('should render card correctly if one source with only a link is passed in', () => {
|
|
17
|
-
render(_jsx(SourcesCardBase, { sources: [{ link: '' }] }));
|
|
18
|
-
expect(screen.getByText('Source 1')).toBeTruthy();
|
|
19
|
-
// no buttons or navigation when there is only 1 source
|
|
20
|
-
expect(screen.queryByRole('button')).toBeFalsy();
|
|
21
|
-
expect(screen.queryByText('1/1')).toBeFalsy();
|
|
22
|
-
});
|
|
23
|
-
it('should render card correctly if one source with a title is passed in', () => {
|
|
24
|
-
render(_jsx(SourcesCardBase, { sources: [{ title: 'How to make an apple pie', link: '' }] }));
|
|
25
|
-
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
26
|
-
});
|
|
27
|
-
it('should render card correctly if one source with a body is passed in', () => {
|
|
28
|
-
render(_jsx(SourcesCardBase, { sources: [{ link: '', body: 'To make an apple pie, you must first...' }] }));
|
|
29
|
-
expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
|
|
30
|
-
});
|
|
31
|
-
it('should render card correctly if one source with a title and body is passed in', () => {
|
|
32
|
-
render(_jsx(SourcesCardBase, { sources: [{ title: 'How to make an apple pie', link: '', body: 'To make an apple pie, you must first...' }] }));
|
|
33
|
-
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
34
|
-
expect(screen.getByText('To make an apple pie, you must first...')).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
it('should render multiple cards correctly', () => {
|
|
37
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
38
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
39
|
-
{ title: 'How to make cookies', link: '' }
|
|
40
|
-
] }));
|
|
41
|
-
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
42
|
-
expect(screen.getByText('1/2')).toBeTruthy();
|
|
43
|
-
screen.getByRole('button', { name: /Go to previous page/i });
|
|
44
|
-
screen.getByRole('button', { name: /Go to next page/i });
|
|
45
|
-
});
|
|
46
|
-
it('should navigate between cards correctly', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
48
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
49
|
-
{ title: 'How to make cookies', link: '' }
|
|
50
|
-
] }));
|
|
51
|
-
expect(screen.getByText('How to make an apple pie')).toBeTruthy();
|
|
52
|
-
expect(screen.getByText('1/2')).toBeTruthy();
|
|
53
|
-
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
|
|
54
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
|
55
|
-
expect(screen.queryByText('How to make an apple pie')).toBeFalsy();
|
|
56
|
-
expect(screen.getByText('How to make cookies')).toBeTruthy();
|
|
57
|
-
expect(screen.getByText('2/2')).toBeTruthy();
|
|
58
|
-
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeEnabled();
|
|
59
|
-
expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
|
|
60
|
-
}));
|
|
61
|
-
it('should apply className appropriately', () => {
|
|
62
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
63
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
64
|
-
{ title: 'How to make cookies', link: '' }
|
|
65
|
-
], className: "test" }));
|
|
66
|
-
const element = screen.getByRole('navigation');
|
|
67
|
-
expect(element).toHaveClass('test');
|
|
68
|
-
});
|
|
69
|
-
it('should disable pagination appropriately', () => {
|
|
70
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
71
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
72
|
-
{ title: 'How to make cookies', link: '' }
|
|
73
|
-
], isDisabled: true }));
|
|
74
|
-
expect(screen.getByRole('button', { name: /Go to previous page/i })).toBeDisabled();
|
|
75
|
-
expect(screen.getByRole('button', { name: /Go to next page/i })).toBeDisabled();
|
|
76
|
-
});
|
|
77
|
-
it('should render navigation aria label appropriately', () => {
|
|
78
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
79
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
80
|
-
{ title: 'How to make cookies', link: '' }
|
|
81
|
-
] }));
|
|
82
|
-
expect(screen.getByRole('navigation', { name: /Pagination/i })).toBeTruthy();
|
|
83
|
-
});
|
|
84
|
-
it('should change paginationAriaLabel appropriately', () => {
|
|
85
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
86
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
87
|
-
{ title: 'How to make cookies', link: '' }
|
|
88
|
-
], paginationAriaLabel: "Navegaci\u00F3n" }));
|
|
89
|
-
expect(screen.getByRole('navigation', { name: /Navegación/i })).toBeTruthy();
|
|
90
|
-
});
|
|
91
|
-
it('should change toNextPageAriaLabel appropriately', () => {
|
|
92
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
93
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
94
|
-
{ title: 'How to make cookies', link: '' }
|
|
95
|
-
], toNextPageAriaLabel: "Pase a la siguiente p\u00E1gina" }));
|
|
96
|
-
expect(screen.getByRole('button', { name: /Pase a la siguiente página/i })).toBeTruthy();
|
|
97
|
-
});
|
|
98
|
-
it('should change toPreviousPageAriaLabel appropriately', () => {
|
|
99
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
100
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
101
|
-
{ title: 'How to make cookies', link: '' }
|
|
102
|
-
], toPreviousPageAriaLabel: "Presione para regresar a la p\u00E1gina anterior" }));
|
|
103
|
-
expect(screen.getByRole('button', { name: /Presione para regresar a la página anterior/i })).toBeTruthy();
|
|
104
|
-
});
|
|
105
|
-
it('should call onNextClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
-
const spy = jest.fn();
|
|
107
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
108
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
109
|
-
{ title: 'How to make cookies', link: '' }
|
|
110
|
-
], onNextClick: spy }));
|
|
111
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
|
112
|
-
expect(spy).toHaveBeenCalled();
|
|
113
|
-
}));
|
|
114
|
-
it('should call onPreviousClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
115
|
-
const spy = jest.fn();
|
|
116
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
117
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
118
|
-
{ title: 'How to make cookies', link: '' }
|
|
119
|
-
], onPreviousClick: spy }));
|
|
120
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
|
121
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to previous page/i }));
|
|
122
|
-
expect(spy).toHaveBeenCalled();
|
|
123
|
-
}));
|
|
124
|
-
it('should call onSetPage appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
-
const spy = jest.fn();
|
|
126
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
127
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
128
|
-
{ title: 'How to make cookies', link: '' }
|
|
129
|
-
], onSetPage: spy }));
|
|
130
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to next page/i }));
|
|
131
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
132
|
-
yield userEvent.click(screen.getByRole('button', { name: /Go to previous page/i }));
|
|
133
|
-
expect(spy).toHaveBeenCalledTimes(2);
|
|
134
|
-
}));
|
|
135
|
-
it('should handle showMore appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
136
|
-
render(_jsx(SourcesCardBase, { sources: [
|
|
137
|
-
{
|
|
138
|
-
title: 'Getting started with Red Hat OpenShift',
|
|
139
|
-
link: '#',
|
|
140
|
-
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...',
|
|
141
|
-
hasShowMore: true
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
title: 'Azure Red Hat OpenShift documentation',
|
|
145
|
-
link: '#',
|
|
146
|
-
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...'
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
title: 'OKD Documentation: Home',
|
|
150
|
-
link: '#',
|
|
151
|
-
body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon ...'
|
|
152
|
-
}
|
|
153
|
-
] }));
|
|
154
|
-
expect(screen.getByRole('region')).toHaveAttribute('class', 'pf-v6-c-expandable-section__content');
|
|
155
|
-
}));
|
|
156
|
-
it('should call onClick appropriately', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
|
-
const spy = jest.fn();
|
|
158
|
-
render(_jsx(SourcesCardBase, { sources: [{ title: 'How to make an apple pie', link: '', onClick: spy }] }));
|
|
159
|
-
yield userEvent.click(screen.getByRole('link', { name: /How to make an apple pie/i }));
|
|
160
|
-
expect(spy).toHaveBeenCalled();
|
|
161
|
-
}));
|
|
162
|
-
it('should apply titleProps appropriately', () => {
|
|
163
|
-
render(_jsx(SourcesCardBase, { sources: [{ title: 'How to make an apple pie', link: '', titleProps: { className: 'test' } }] }));
|
|
164
|
-
expect(screen.getByRole('link', { name: /How to make an apple pie/i })).toHaveClass('test');
|
|
165
|
-
});
|
|
166
|
-
it('should render with wrap layout when layout prop is set to wrap', () => {
|
|
167
|
-
render(_jsx(SourcesCardBase, { layout: "wrap", sources: [
|
|
168
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
169
|
-
{ title: 'How to make cookies', link: '' },
|
|
170
|
-
{ title: 'How to make a sandwich', link: '' }
|
|
171
|
-
] }));
|
|
172
|
-
expect(screen.getByText('How to make an apple pie')).toBeVisible();
|
|
173
|
-
expect(screen.getByText('How to make cookies')).toBeVisible();
|
|
174
|
-
expect(screen.getByText('How to make a sandwich')).toBeVisible();
|
|
175
|
-
expect(screen.queryByRole('navigation')).not.toBeInTheDocument();
|
|
176
|
-
expect(screen.queryByText('1/3')).not.toBeInTheDocument();
|
|
177
|
-
});
|
|
178
|
-
it('should apply default cardMaxWidth when using wrap layout', () => {
|
|
179
|
-
render(_jsx(SourcesCardBase, { layout: "wrap", sources: [
|
|
180
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
181
|
-
{ title: 'How to make cookies', link: '' }
|
|
182
|
-
] }));
|
|
183
|
-
const firstListItem = screen.getByText('How to make an apple pie').closest('.pf-chatbot__sources-list-item');
|
|
184
|
-
expect(firstListItem).toHaveStyle({ '--pf-chatbot-sources-card-max-width': '400px' });
|
|
185
|
-
});
|
|
186
|
-
it('should apply custom cardMaxWidth when using wrap layout', () => {
|
|
187
|
-
render(_jsx(SourcesCardBase, { layout: "wrap", sources: [
|
|
188
|
-
{ title: 'How to make an apple pie', link: '' },
|
|
189
|
-
{ title: 'How to make cookies', link: '' }
|
|
190
|
-
], cardMaxWidth: "500px" }));
|
|
191
|
-
const firstListItem = screen.getByText('How to make an apple pie').closest('.pf-chatbot__sources-list-item');
|
|
192
|
-
expect(firstListItem).toHaveStyle({ '--pf-chatbot-sources-card-max-width': '500px' });
|
|
193
|
-
});
|
|
194
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { render, screen } from '@testing-library/react';
|
|
12
|
-
import '@testing-library/jest-dom';
|
|
13
|
-
import userEvent from '@testing-library/user-event';
|
|
14
|
-
import TermsOfUse from './TermsOfUse';
|
|
15
|
-
import { Content } from '@patternfly/react-core';
|
|
16
|
-
const handleModalToggle = jest.fn();
|
|
17
|
-
const onPrimaryAction = jest.fn();
|
|
18
|
-
const onSecondaryAction = jest.fn();
|
|
19
|
-
const body = (_jsxs(Content, { children: [_jsx("h1", { children: "Heading 1" }), _jsx("p", { children: "Legal text" })] }));
|
|
20
|
-
describe('TermsOfUse', () => {
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
jest.clearAllMocks();
|
|
23
|
-
});
|
|
24
|
-
it('should render modal correctly', () => {
|
|
25
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, ouiaId: "Terms", children: body }));
|
|
26
|
-
expect(screen.getByRole('heading', { name: /Terms of use/i })).toBeTruthy();
|
|
27
|
-
expect(screen.getByRole('button', { name: /Accept/i })).toBeTruthy();
|
|
28
|
-
expect(screen.getByRole('button', { name: /Decline/i })).toBeTruthy();
|
|
29
|
-
expect(screen.getByRole('heading', { name: /Heading 1/i })).toBeTruthy();
|
|
30
|
-
expect(screen.getByText(/Legal text/i)).toBeTruthy();
|
|
31
|
-
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal');
|
|
32
|
-
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal--default');
|
|
33
|
-
});
|
|
34
|
-
it('should handle image and altText props', () => {
|
|
35
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, image: "./image.png", altText: "Test image", children: body }));
|
|
36
|
-
expect(screen.getByRole('img')).toBeTruthy();
|
|
37
|
-
expect(screen.getByRole('img')).toHaveAttribute('alt', 'Test image');
|
|
38
|
-
});
|
|
39
|
-
it('should handle className prop', () => {
|
|
40
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, className: "test", children: body }));
|
|
41
|
-
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal');
|
|
42
|
-
expect(screen.getByRole('dialog')).toHaveClass('pf-chatbot__terms-of-use-modal--default');
|
|
43
|
-
expect(screen.getByRole('dialog')).toHaveClass('test');
|
|
44
|
-
});
|
|
45
|
-
it('should handle title prop', () => {
|
|
46
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, title: "Updated title", children: body }));
|
|
47
|
-
expect(screen.getByRole('heading', { name: /Updated title/i })).toBeTruthy();
|
|
48
|
-
expect(screen.queryByRole('heading', { name: /Terms of use/i })).toBeFalsy();
|
|
49
|
-
});
|
|
50
|
-
it('should handle primary button prop', () => {
|
|
51
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, primaryActionBtn: "First", children: body }));
|
|
52
|
-
expect(screen.getByRole('button', { name: /First/i })).toBeTruthy();
|
|
53
|
-
expect(screen.queryByRole('button', { name: /Accept/i })).toBeFalsy();
|
|
54
|
-
});
|
|
55
|
-
it('should handle secondary button prop', () => {
|
|
56
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, secondaryActionBtn: "Second", children: body }));
|
|
57
|
-
expect(screen.getByRole('button', { name: /Second/i })).toBeTruthy();
|
|
58
|
-
expect(screen.queryByRole('button', { name: /Deny/i })).toBeFalsy();
|
|
59
|
-
});
|
|
60
|
-
it('should handle primary button click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onPrimaryAction: onPrimaryAction, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, children: body }));
|
|
62
|
-
yield userEvent.click(screen.getByRole('button', { name: /Accept/i }));
|
|
63
|
-
expect(onPrimaryAction).toHaveBeenCalledTimes(1);
|
|
64
|
-
expect(handleModalToggle).toHaveBeenCalledTimes(1);
|
|
65
|
-
}));
|
|
66
|
-
it('should handle secondary button click', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
render(_jsx(TermsOfUse, { isModalOpen: true, onSecondaryAction: onSecondaryAction, handleModalToggle: handleModalToggle, children: body }));
|
|
68
|
-
yield userEvent.click(screen.getByRole('button', { name: /Decline/i }));
|
|
69
|
-
expect(onSecondaryAction).toHaveBeenCalledTimes(1);
|
|
70
|
-
expect(handleModalToggle).not.toHaveBeenCalled();
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { render, screen } from '@testing-library/react';
|
|
12
|
-
import userEvent from '@testing-library/user-event';
|
|
13
|
-
import '@testing-library/jest-dom';
|
|
14
|
-
import ToolCall from './ToolCall';
|
|
15
|
-
describe('ToolCall', () => {
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
titleText: 'ToolCall Title',
|
|
18
|
-
loadingText: 'Loading ToolCall'
|
|
19
|
-
};
|
|
20
|
-
it('Renders with passed in titleText', () => {
|
|
21
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps)));
|
|
22
|
-
expect(screen.getByText(defaultProps.titleText)).toBeVisible();
|
|
23
|
-
});
|
|
24
|
-
it('Does not render with passed in loadingText when isLoading is false', () => {
|
|
25
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps)));
|
|
26
|
-
expect(screen.queryByText(defaultProps.loadingText)).not.toBeInTheDocument();
|
|
27
|
-
});
|
|
28
|
-
it('Renders with passed in loadingText when isLoading is true', () => {
|
|
29
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isLoading: true })));
|
|
30
|
-
expect(screen.getByText(defaultProps.loadingText)).toBeVisible();
|
|
31
|
-
});
|
|
32
|
-
it('Does not render titleText when isLoading is true', () => {
|
|
33
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isLoading: true })));
|
|
34
|
-
expect(screen.queryByText(defaultProps.titleText)).not.toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
it('Passes spinnerProps to Spinner', () => {
|
|
37
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isLoading: true, spinnerProps: { id: 'spinner-test-id' } })));
|
|
38
|
-
expect(screen.getByRole('progressbar')).toHaveAttribute('id', 'spinner-test-id');
|
|
39
|
-
});
|
|
40
|
-
it('Does not render expandable toggle by default', () => {
|
|
41
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps)));
|
|
42
|
-
expect(screen.queryByRole('button', { name: defaultProps.titleText })).not.toBeInTheDocument();
|
|
43
|
-
});
|
|
44
|
-
it('Renders titleText inside expandable toggle when expandableContent is passed', () => {
|
|
45
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: "Expandable Content" })));
|
|
46
|
-
expect(screen.getByRole('button', { name: defaultProps.titleText })).toBeVisible();
|
|
47
|
-
});
|
|
48
|
-
it('Does not render expandable content when expandableContent is passed by default', () => {
|
|
49
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: "Expandable Content" })));
|
|
50
|
-
expect(screen.queryByText('Expandable Content')).not.toBeVisible();
|
|
51
|
-
});
|
|
52
|
-
it('Renders expandable content when expandableContent is passed and toggle is clicked', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
const user = userEvent.setup();
|
|
54
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: "Expandable Content" })));
|
|
55
|
-
yield user.click(screen.getByRole('button', { name: defaultProps.titleText }));
|
|
56
|
-
expect(screen.getByText('Expandable Content')).toBeVisible();
|
|
57
|
-
}));
|
|
58
|
-
it('Passes expandableSectionProps to ExpandableSection', () => {
|
|
59
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: "Expandable Content", expandableSectionProps: { id: 'expandable-section-test-id', isExpanded: true } })));
|
|
60
|
-
expect(screen.getByRole('region').parentElement).toHaveAttribute('id', 'expandable-section-test-id');
|
|
61
|
-
});
|
|
62
|
-
it('Renders "run" action button by default', () => {
|
|
63
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps)));
|
|
64
|
-
expect(screen.getByRole('button', { name: 'Run tool' })).toBeVisible();
|
|
65
|
-
});
|
|
66
|
-
it('Renders "cancel" action button by default', () => {
|
|
67
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps)));
|
|
68
|
-
expect(screen.getByRole('button', { name: 'Cancel' })).toBeVisible();
|
|
69
|
-
});
|
|
70
|
-
it('Does not render "run" action button when isLoading is true', () => {
|
|
71
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isLoading: true })));
|
|
72
|
-
expect(screen.queryByRole('button', { name: 'Run tool' })).not.toBeInTheDocument();
|
|
73
|
-
});
|
|
74
|
-
it('Does not render "cancel" action button when isLoading is true', () => {
|
|
75
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isLoading: true })));
|
|
76
|
-
expect(screen.queryByRole('button', { name: 'Cancel' })).not.toBeInTheDocument();
|
|
77
|
-
});
|
|
78
|
-
it('Renders runButtonText when passed', () => {
|
|
79
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { runButtonText: "Run my custom tool" })));
|
|
80
|
-
expect(screen.getByRole('button', { name: 'Run my custom tool' })).toBeVisible();
|
|
81
|
-
});
|
|
82
|
-
it('Renders cancelButtonText when passed', () => {
|
|
83
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cancelButtonText: "Cancel my custom tool" })));
|
|
84
|
-
expect(screen.getByRole('button', { name: 'Cancel my custom tool' })).toBeVisible();
|
|
85
|
-
});
|
|
86
|
-
it('Passes runButtonProps to Button', () => {
|
|
87
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { runButtonProps: { id: 'run-button-test-id' } })));
|
|
88
|
-
expect(screen.getByRole('button', { name: 'Run tool' })).toHaveAttribute('id', 'run-button-test-id');
|
|
89
|
-
});
|
|
90
|
-
it('Passes cancelButtonProps to Button', () => {
|
|
91
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cancelButtonProps: { id: 'cancel-button-test-id' } })));
|
|
92
|
-
expect(screen.getByRole('button', { name: 'Cancel' })).toHaveAttribute('id', 'cancel-button-test-id');
|
|
93
|
-
});
|
|
94
|
-
it('Passes runActionItemProps to ActionListItem', () => {
|
|
95
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { runActionItemProps: { id: 'run-action-item-test-id' } })));
|
|
96
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).parentElement).toHaveAttribute('id', 'run-action-item-test-id');
|
|
97
|
-
});
|
|
98
|
-
it('Passes cancelActionItemProps to ActionListItem', () => {
|
|
99
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cancelActionItemProps: { id: 'cancel-action-item-test-id' } })));
|
|
100
|
-
expect(screen.getByRole('button', { name: 'Cancel' }).parentElement).toHaveAttribute('id', 'cancel-action-item-test-id');
|
|
101
|
-
});
|
|
102
|
-
it('Passes actionListProps to ActionList', () => {
|
|
103
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { actionListProps: { id: 'action-list-test-id' } })));
|
|
104
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).closest('#action-list-test-id')).toBeVisible();
|
|
105
|
-
});
|
|
106
|
-
it('Passes actionListGroupProps to ActionListGroup', () => {
|
|
107
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { actionListGroupProps: { id: 'action-list-group-test-id' } })));
|
|
108
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).closest('#action-list-group-test-id')).toBeVisible();
|
|
109
|
-
});
|
|
110
|
-
it('Passes actionListItemProps to ActionListItem for default actions', () => {
|
|
111
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { actionListItemProps: { className: 'action-list-item-test-class' } })));
|
|
112
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).parentElement).toHaveClass('action-list-item-test-class');
|
|
113
|
-
expect(screen.getByRole('button', { name: 'Cancel' }).parentElement).toHaveClass('action-list-item-test-class');
|
|
114
|
-
});
|
|
115
|
-
it('Renders custom actions instead of default actions when actions are passed', () => {
|
|
116
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { actions: [_jsx("div", { children: "Custom action 1" }, "custom-action-1"), _jsx("div", { children: "Custom action 2" }, "custom-action-2")] })));
|
|
117
|
-
expect(screen.getByText('Custom action 1')).toBeVisible();
|
|
118
|
-
expect(screen.getByText('Custom action 2')).toBeVisible();
|
|
119
|
-
expect(screen.queryByRole('button', { name: 'Run tool' })).not.toBeInTheDocument();
|
|
120
|
-
expect(screen.queryByRole('button', { name: 'Cancel' })).not.toBeInTheDocument();
|
|
121
|
-
});
|
|
122
|
-
it('Passes actionListItemProps to ActionListItem for custom actions', () => {
|
|
123
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { actions: [_jsx("div", { children: "Custom action 1" }, "custom-action-1"), _jsx("div", { children: "Custom action 2" }, "custom-action-2")], actionListItemProps: { className: 'action-list-item-test-class' } })));
|
|
124
|
-
expect(screen.getByText('Custom action 1').parentElement).toHaveClass('action-list-item-test-class');
|
|
125
|
-
expect(screen.getByText('Custom action 2').parentElement).toHaveClass('action-list-item-test-class');
|
|
126
|
-
});
|
|
127
|
-
it('Passes cardProps to Card', () => {
|
|
128
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cardProps: { id: 'card-test-id' } })));
|
|
129
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).closest('#card-test-id')).toBeVisible();
|
|
130
|
-
});
|
|
131
|
-
it('Passes cardBodyProps to CardBody', () => {
|
|
132
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cardBodyProps: { id: 'card-body-test-id' } })));
|
|
133
|
-
expect(screen.getByText(defaultProps.titleText).closest('#card-body-test-id')).toBeVisible();
|
|
134
|
-
});
|
|
135
|
-
it('Passes cardFooterProps to CardFooter', () => {
|
|
136
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { cardFooterProps: { id: 'card-footer-test-id' } })));
|
|
137
|
-
expect(screen.getByRole('button', { name: 'Run tool' }).closest('#card-footer-test-id')).toBeVisible();
|
|
138
|
-
});
|
|
139
|
-
it('Renders collapsed by default when expandableContent is provided', () => {
|
|
140
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: "Expandable Content" })));
|
|
141
|
-
expect(screen.getByRole('button', { name: defaultProps.titleText })).toHaveAttribute('aria-expanded', 'false');
|
|
142
|
-
expect(screen.queryByText('Expandable Content')).not.toBeVisible();
|
|
143
|
-
});
|
|
144
|
-
it('Renders expanded when isDefaultExpanded is true', () => {
|
|
145
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isDefaultExpanded: true, expandableContent: "Expandable Content" })));
|
|
146
|
-
expect(screen.getByRole('button', { name: defaultProps.titleText })).toHaveAttribute('aria-expanded', 'true');
|
|
147
|
-
expect(screen.getByText('Expandable Content')).toBeVisible();
|
|
148
|
-
});
|
|
149
|
-
it('expandableSectionProps.isExpanded overrides isDefaultExpanded', () => {
|
|
150
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isDefaultExpanded: false, expandableContent: "Expandable Content", expandableSectionProps: { isExpanded: true } })));
|
|
151
|
-
expect(screen.getByRole('button', { name: defaultProps.titleText })).toHaveAttribute('aria-expanded', 'true');
|
|
152
|
-
expect(screen.getByText('Expandable Content')).toBeVisible();
|
|
153
|
-
});
|
|
154
|
-
it('expandableSectionProps.onToggle overrides internal onToggle behavior', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
-
const user = userEvent.setup();
|
|
156
|
-
const customOnToggle = jest.fn();
|
|
157
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { isDefaultExpanded: false, expandableContent: "Expandable Content", expandableSectionProps: { onToggle: customOnToggle } })));
|
|
158
|
-
const toggleButton = screen.getByRole('button', { name: defaultProps.titleText });
|
|
159
|
-
expect(toggleButton).toHaveAttribute('aria-expanded', 'false');
|
|
160
|
-
yield user.click(toggleButton);
|
|
161
|
-
expect(customOnToggle).toHaveBeenCalledTimes(1);
|
|
162
|
-
expect(toggleButton).toHaveAttribute('aria-expanded', 'false');
|
|
163
|
-
expect(screen.queryByText('Expandable Content')).not.toBeVisible();
|
|
164
|
-
}));
|
|
165
|
-
it('should render titleText as markdown when isTitleMarkdown is true', () => {
|
|
166
|
-
const titleText = '**Bold title**';
|
|
167
|
-
const { container } = render(_jsx(ToolCall, { titleText: titleText, isTitleMarkdown: true }));
|
|
168
|
-
expect(container.querySelector('strong')).toBeTruthy();
|
|
169
|
-
expect(screen.getByText('Bold title')).toBeTruthy();
|
|
170
|
-
});
|
|
171
|
-
it('should not render titleText as markdown when isTitleMarkdown is false', () => {
|
|
172
|
-
const titleText = '**Bold title**';
|
|
173
|
-
render(_jsx(ToolCall, { titleText: titleText }));
|
|
174
|
-
expect(screen.getByText('**Bold title**')).toBeTruthy();
|
|
175
|
-
});
|
|
176
|
-
it('should render expandableContent as markdown when isExpandableContentMarkdown is true', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
177
|
-
const user = userEvent.setup();
|
|
178
|
-
const expandableContent = '**Bold expandable content**';
|
|
179
|
-
const { container } = render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: expandableContent, isExpandableContentMarkdown: true })));
|
|
180
|
-
yield user.click(screen.getByRole('button', { name: defaultProps.titleText }));
|
|
181
|
-
expect(container.querySelector('strong')).toBeTruthy();
|
|
182
|
-
expect(screen.getByText('Bold expandable content')).toBeTruthy();
|
|
183
|
-
}));
|
|
184
|
-
it('should not render expandableContent as markdown when isExpandableContentMarkdown is false', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
185
|
-
const user = userEvent.setup();
|
|
186
|
-
const expandableContent = '**Bold expandable content**';
|
|
187
|
-
render(_jsx(ToolCall, Object.assign({}, defaultProps, { expandableContent: expandableContent })));
|
|
188
|
-
yield user.click(screen.getByRole('button', { name: defaultProps.titleText }));
|
|
189
|
-
expect(screen.getByText('**Bold expandable content**')).toBeTruthy();
|
|
190
|
-
}));
|
|
191
|
-
it('should pass markdownContentProps to MarkdownContent component', () => {
|
|
192
|
-
const titleText = '**Bold title**';
|
|
193
|
-
const { container } = render(_jsx(ToolCall, { titleText: titleText, isTitleMarkdown: true, markdownContentProps: { isPrimary: true } }));
|
|
194
|
-
expect(container.querySelector('.pf-m-primary')).toBeTruthy();
|
|
195
|
-
});
|
|
196
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|