@patternfly/chatbot 6.9.0-prerelease.4 → 6.9.0-prerelease.6

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.
@@ -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 (!(popover === null || popover === void 0 ? void 0 : popover.cta) && !(popover === null || popover === void 0 ? void 0 : popover.showClose)) {
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
  }
package/dist/css/main.css CHANGED
@@ -2424,11 +2424,11 @@ li[id*=user-content-fn-]:has(> span > span > .pf-chatbot__message-text + .pf-cha
2424
2424
  transition: border-color var(--pf-t--global--motion--timing-function--accelerate) var(--pf-t--global--motion--duration--sm), border-width var(--pf-t--global--motion--timing-function--accelerate) var(--pf-t--global--motion--duration--sm);
2425
2425
  }
2426
2426
  .pf-chatbot__message-bar:hover::after {
2427
- border-color: var(--pf-t--global--border--color--control--hover);
2427
+ border-color: var(--pf-t--global--border--color--hover);
2428
2428
  border-width: var(--pf-t--global--border--width--control--hover);
2429
2429
  }
2430
2430
  .pf-chatbot__message-bar:focus-within::after {
2431
- border-color: var(--pf-t--global--border--color--control--clicked);
2431
+ border-color: var(--pf-t--global--border--color--clicked);
2432
2432
  border-width: var(--pf-t--global--border--width--control--clicked);
2433
2433
  }
2434
2434
  .pf-chatbot__message-bar-actions {
@@ -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 (!(popover === null || popover === void 0 ? void 0 : popover.cta) && !(popover === null || popover === void 0 ? void 0 : popover.showClose)) {
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.4",
3
+ "version": "6.9.0-prerelease.6",
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",
@@ -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?.cta && !popover?.showClose) {
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.'
@@ -46,14 +46,14 @@
46
46
 
47
47
  &:hover {
48
48
  &::after {
49
- border-color: var(--pf-t--global--border--color--control--hover);
49
+ border-color: var(--pf-t--global--border--color--hover);
50
50
  border-width: var(--pf-t--global--border--width--control--hover);
51
51
  }
52
52
  }
53
53
 
54
54
  &:focus-within {
55
55
  &::after {
56
- border-color: var(--pf-t--global--border--color--control--clicked);
56
+ border-color: var(--pf-t--global--border--color--clicked);
57
57
  border-width: var(--pf-t--global--border--width--control--clicked);
58
58
  }
59
59
  }