@patternfly/chatbot 6.9.0-prerelease.3 → 6.9.0-prerelease.5
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/ChatbotFooter/ChatbotFootnote.js +1 -1
- package/dist/esm/ChatbotFooter/ChatbotFootnote.js +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.md +0 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Canvas.tsx +1 -2
- package/src/ChatbotFooter/ChatbotFooternote.test.tsx +50 -0
- package/src/ChatbotFooter/ChatbotFootnote.tsx +1 -1
|
@@ -23,7 +23,7 @@ const ChatbotPopover_1 = __importDefault(require("../ChatbotPopover/ChatbotPopov
|
|
|
23
23
|
const ChatbotFootnote = (_a) => {
|
|
24
24
|
var _b, _c, _d, _e, _f;
|
|
25
25
|
var { label, popover, className } = _a, props = __rest(_a, ["label", "popover", "className"]);
|
|
26
|
-
if (
|
|
26
|
+
if (popover && !popover.cta && !popover.showClose) {
|
|
27
27
|
// eslint-disable-next-line no-console
|
|
28
28
|
console.error('ChatbotFootnote: You must provide either the popover.cta or popover.showClose props in order to render a button that can close the popover.');
|
|
29
29
|
}
|
|
@@ -17,7 +17,7 @@ import ChatbotPopover from '../ChatbotPopover/ChatbotPopover';
|
|
|
17
17
|
export const ChatbotFootnote = (_a) => {
|
|
18
18
|
var _b, _c, _d, _e, _f;
|
|
19
19
|
var { label, popover, className } = _a, props = __rest(_a, ["label", "popover", "className"]);
|
|
20
|
-
if (
|
|
20
|
+
if (popover && !popover.cta && !popover.showClose) {
|
|
21
21
|
// eslint-disable-next-line no-console
|
|
22
22
|
console.error('ChatbotFootnote: You must provide either the popover.cta or popover.showClose props in order to render a button that can close the popover.');
|
|
23
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/chatbot",
|
|
3
|
-
"version": "6.9.0-prerelease.
|
|
3
|
+
"version": "6.9.0-prerelease.5",
|
|
4
4
|
"description": "This library provides React components based on PatternFly 6 that can be used to build chatbots.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -52,7 +52,6 @@ import RhUiExportIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-export-
|
|
|
52
52
|
import RhUiRedoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-redo-icon';
|
|
53
53
|
import RhUiUndoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-undo-icon';
|
|
54
54
|
import RhUiServerUploadFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-server-upload-fill-icon';
|
|
55
|
-
import RhUiAiEditIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-edit-icon';
|
|
56
55
|
import RhUiAiInfoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-info-icon';
|
|
57
56
|
import { useDropzone } from 'react-dropzone';
|
|
58
57
|
import PFIconLogoColor from '../UI/PF-IconLogo-Color.svg';
|
|
@@ -39,7 +39,6 @@ import ChatbotHeader, {
|
|
|
39
39
|
ChatbotHeaderMenu,
|
|
40
40
|
ChatbotHeaderTitle
|
|
41
41
|
} from '@patternfly/chatbot/dist/dynamic/ChatbotHeader';
|
|
42
|
-
import RhUiAiEditIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-edit-icon';
|
|
43
42
|
import RhUiAiInfoIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-ai-info-icon';
|
|
44
43
|
import RhUiImageFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-image-fill-icon';
|
|
45
44
|
import RhUiAddIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-add-icon';
|
|
@@ -401,7 +400,7 @@ export const Canvas: FunctionComponent = () => {
|
|
|
401
400
|
<Label
|
|
402
401
|
isClickable
|
|
403
402
|
variant="outline"
|
|
404
|
-
icon={<
|
|
403
|
+
icon={<RhUiAiInfoIcon aria-hidden />}
|
|
405
404
|
role="button"
|
|
406
405
|
tabIndex={0}
|
|
407
406
|
aria-expanded={isGeneratedAiPopoverOpen}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
2
|
import ChatbotFootnote from './ChatbotFootnote';
|
|
3
3
|
|
|
4
|
+
const POPOVER_CLOSE_ERROR =
|
|
5
|
+
'ChatbotFootnote: You must provide either the popover.cta or popover.showClose props in order to render a button that can close the popover.';
|
|
6
|
+
|
|
4
7
|
describe('ChatbotFooternote', () => {
|
|
5
8
|
const onClick = jest.fn();
|
|
6
9
|
const popoverProps = {
|
|
@@ -20,11 +23,58 @@ describe('ChatbotFooternote', () => {
|
|
|
20
23
|
}
|
|
21
24
|
};
|
|
22
25
|
|
|
26
|
+
let consoleErrorSpy: jest.SpyInstance;
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(jest.fn());
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
consoleErrorSpy.mockRestore();
|
|
34
|
+
});
|
|
35
|
+
|
|
23
36
|
it('should render ChatbotFooternote', () => {
|
|
24
37
|
render(<ChatbotFootnote label="Chatbot footer" />);
|
|
25
38
|
expect(screen.getByText('Chatbot footer')).toBeTruthy();
|
|
26
39
|
});
|
|
27
40
|
|
|
41
|
+
it('should not log a console error when no popover is provided', () => {
|
|
42
|
+
render(<ChatbotFootnote label="Chatbot footer" />);
|
|
43
|
+
expect(consoleErrorSpy).not.toHaveBeenCalledWith(POPOVER_CLOSE_ERROR);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should not log a console error when popover has a cta', () => {
|
|
47
|
+
render(<ChatbotFootnote label="Chatbot footer" popover={popoverProps} />);
|
|
48
|
+
expect(consoleErrorSpy).not.toHaveBeenCalledWith(POPOVER_CLOSE_ERROR);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should not log a console error when popover has showClose', () => {
|
|
52
|
+
render(
|
|
53
|
+
<ChatbotFootnote
|
|
54
|
+
label="Chatbot footer"
|
|
55
|
+
popover={{
|
|
56
|
+
title: 'Verify accuracy',
|
|
57
|
+
description: 'description',
|
|
58
|
+
showClose: true
|
|
59
|
+
}}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
expect(consoleErrorSpy).not.toHaveBeenCalledWith(POPOVER_CLOSE_ERROR);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should log a console error when popover is provided without cta or showClose', () => {
|
|
66
|
+
render(
|
|
67
|
+
<ChatbotFootnote
|
|
68
|
+
label="Chatbot footer"
|
|
69
|
+
popover={{
|
|
70
|
+
title: 'Verify accuracy',
|
|
71
|
+
description: 'description'
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(POPOVER_CLOSE_ERROR);
|
|
76
|
+
});
|
|
77
|
+
|
|
28
78
|
it('should render ChatbotFooternote with popover', async () => {
|
|
29
79
|
render(<ChatbotFootnote label="Chatbot footer" popover={popoverProps} />);
|
|
30
80
|
|
|
@@ -63,7 +63,7 @@ export const ChatbotFootnote: FunctionComponent<ChatbotFootnoteProps> = ({
|
|
|
63
63
|
className,
|
|
64
64
|
...props
|
|
65
65
|
}: ChatbotFootnoteProps) => {
|
|
66
|
-
if (!popover
|
|
66
|
+
if (popover && !popover.cta && !popover.showClose) {
|
|
67
67
|
// eslint-disable-next-line no-console
|
|
68
68
|
console.error(
|
|
69
69
|
'ChatbotFootnote: You must provide either the popover.cta or popover.showClose props in order to render a button that can close the popover.'
|