@patternfly/chatbot 6.3.0-prerelease.10 → 6.3.0-prerelease.11
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/Message/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/cjs/Message/Message.test.js +3 -3
- package/dist/cjs/MessageBar/AttachButton.js +1 -1
- package/dist/cjs/MessageBar/AttachButton.test.js +7 -7
- package/dist/cjs/MessageBar/MessageBar.test.js +29 -29
- package/dist/cjs/MessageBar/MicrophoneButton.js +1 -1
- package/dist/cjs/MessageBar/SendButton.js +1 -1
- package/dist/cjs/MessageBar/SendButton.test.js +5 -5
- package/dist/cjs/MessageBar/StopButton.js +1 -1
- package/dist/cjs/MessageBar/StopButton.test.js +5 -5
- package/dist/cjs/MessageBox/JumpButton.js +1 -1
- package/dist/cjs/MessageBox/JumpButton.test.js +4 -4
- package/dist/cjs/MessageBox/MessageBox.test.js +2 -2
- package/dist/esm/Message/CodeBlockMessage/CodeBlockMessage.js +1 -1
- package/dist/esm/Message/Message.test.js +3 -3
- package/dist/esm/MessageBar/AttachButton.js +1 -1
- package/dist/esm/MessageBar/AttachButton.test.js +7 -7
- package/dist/esm/MessageBar/MessageBar.test.js +29 -29
- package/dist/esm/MessageBar/MicrophoneButton.js +1 -1
- package/dist/esm/MessageBar/SendButton.js +1 -1
- package/dist/esm/MessageBar/SendButton.test.js +5 -5
- package/dist/esm/MessageBar/StopButton.js +1 -1
- package/dist/esm/MessageBar/StopButton.test.js +5 -5
- package/dist/esm/MessageBox/JumpButton.js +1 -1
- package/dist/esm/MessageBox/JumpButton.test.js +4 -4
- package/dist/esm/MessageBox/MessageBox.test.js +2 -2
- package/package.json +1 -1
- package/src/Message/CodeBlockMessage/CodeBlockMessage.tsx +1 -1
- package/src/Message/Message.test.tsx +3 -3
- package/src/MessageBar/AttachButton.test.tsx +7 -7
- package/src/MessageBar/AttachButton.tsx +1 -1
- package/src/MessageBar/MessageBar.test.tsx +29 -29
- package/src/MessageBar/MicrophoneButton.tsx +2 -1
- package/src/MessageBar/SendButton.test.tsx +5 -5
- package/src/MessageBar/SendButton.tsx +1 -1
- package/src/MessageBar/StopButton.test.tsx +5 -5
- package/src/MessageBar/StopButton.tsx +1 -1
- package/src/MessageBox/JumpButton.test.tsx +4 -4
- package/src/MessageBox/JumpButton.tsx +1 -1
- package/src/MessageBox/MessageBox.test.tsx +2 -2
@@ -105,7 +105,8 @@ export const MicrophoneButton: React.FunctionComponent<MicrophoneButtonProps> =
|
|
105
105
|
<Button
|
106
106
|
variant="plain"
|
107
107
|
className={`pf-chatbot__button--microphone ${isListening ? 'pf-chatbot__button--microphone--active' : ''} ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
108
|
-
aria-label={props['aria-label'] || '
|
108
|
+
aria-label={props['aria-label'] || (isListening ? 'Stop listening' : 'Use microphone')}
|
109
|
+
aria-pressed={isListening}
|
109
110
|
onClick={isListening ? stopListening : startListening}
|
110
111
|
icon={
|
111
112
|
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
@@ -12,23 +12,23 @@ const renderSend = (props?: { [key: string]: string | boolean | Omit<TooltipProp
|
|
12
12
|
describe('Send button', () => {
|
13
13
|
it('should render button correctly', () => {
|
14
14
|
renderSend();
|
15
|
-
expect(screen.getByRole('button', { name: 'Send
|
15
|
+
expect(screen.getByRole('button', { name: 'Send' })).toBeTruthy();
|
16
16
|
});
|
17
17
|
it('should handle onClick correctly', async () => {
|
18
18
|
const spy = jest.fn();
|
19
19
|
render(<SendButton onClick={spy} />);
|
20
|
-
await userEvent.click(screen.getByRole('button', { name: 'Send
|
20
|
+
await userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
21
21
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
|
22
22
|
expect(spy).toHaveBeenCalledTimes(1);
|
23
23
|
});
|
24
24
|
it('should handle custom tooltip correctly', async () => {
|
25
25
|
render(<SendButton onClick={jest.fn} tooltipContent="Test" />);
|
26
|
-
await userEvent.click(screen.getByRole('button', { name: 'Send
|
26
|
+
await userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
27
27
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
28
28
|
});
|
29
29
|
it('should handle className prop', () => {
|
30
30
|
renderSend({ className: 'test' });
|
31
|
-
expect(screen.getByRole('button', { name: 'Send
|
31
|
+
expect(screen.getByRole('button', { name: 'Send' })).toHaveClass('test');
|
32
32
|
});
|
33
33
|
|
34
34
|
it('should handle spread props, including aria-label', () => {
|
@@ -37,7 +37,7 @@ describe('Send button', () => {
|
|
37
37
|
});
|
38
38
|
it('should handle tooltipProps prop', async () => {
|
39
39
|
renderSend({ tooltipProps: { id: 'test' } });
|
40
|
-
await userEvent.click(screen.getByRole('button', { name: 'Send
|
40
|
+
await userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
41
41
|
expect(screen.getByRole('tooltip', { name: 'Send' })).toHaveAttribute('id', 'test');
|
42
42
|
});
|
43
43
|
it('should handle isCompact', () => {
|
@@ -43,7 +43,7 @@ export const SendButton: React.FunctionComponent<SendButtonProps> = ({
|
|
43
43
|
<Button
|
44
44
|
variant="plain"
|
45
45
|
className={`pf-chatbot__button--send ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
46
|
-
aria-label={props['aria-label'] || 'Send
|
46
|
+
aria-label={props['aria-label'] || 'Send'}
|
47
47
|
onClick={onClick}
|
48
48
|
icon={
|
49
49
|
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
@@ -12,23 +12,23 @@ const renderStop = (props?: { [key: string]: string | boolean | Omit<TooltipProp
|
|
12
12
|
describe('Stop button', () => {
|
13
13
|
it('should render button correctly', () => {
|
14
14
|
renderStop();
|
15
|
-
expect(screen.getByRole('button', { name: 'Stop
|
15
|
+
expect(screen.getByRole('button', { name: 'Stop' })).toBeTruthy();
|
16
16
|
});
|
17
17
|
it('should handle onClick correctly', async () => {
|
18
18
|
const spy = jest.fn();
|
19
19
|
render(<StopButton onClick={spy} />);
|
20
|
-
await userEvent.click(screen.getByRole('button', { name: 'Stop
|
20
|
+
await userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
21
21
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
|
22
22
|
expect(spy).toHaveBeenCalledTimes(1);
|
23
23
|
});
|
24
24
|
it('should handle custom tooltip correctly', async () => {
|
25
25
|
render(<StopButton onClick={jest.fn} tooltipContent="Test" />);
|
26
|
-
await userEvent.click(screen.getByRole('button', { name: 'Stop
|
26
|
+
await userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
27
27
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
28
28
|
});
|
29
29
|
it('should handle className prop', () => {
|
30
30
|
renderStop({ className: 'test' });
|
31
|
-
expect(screen.getByRole('button', { name: 'Stop
|
31
|
+
expect(screen.getByRole('button', { name: 'Stop' })).toHaveClass('test');
|
32
32
|
});
|
33
33
|
it('should handle spread props, including aria-label', () => {
|
34
34
|
renderStop({ 'aria-label': 'test' });
|
@@ -36,7 +36,7 @@ describe('Stop button', () => {
|
|
36
36
|
});
|
37
37
|
it('should handle tooltipProps prop', async () => {
|
38
38
|
renderStop({ tooltipProps: { id: 'test' } });
|
39
|
-
await userEvent.click(screen.getByRole('button', { name: 'Stop
|
39
|
+
await userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
40
40
|
expect(screen.getByRole('tooltip', { name: 'Stop' })).toHaveAttribute('id', 'test');
|
41
41
|
});
|
42
42
|
it('should handle isCompact', () => {
|
@@ -41,7 +41,7 @@ export const StopButton: React.FunctionComponent<StopButtonProps> = ({
|
|
41
41
|
<Button
|
42
42
|
className={`pf-chatbot__button--stop ${isCompact ? 'pf-m-compact' : ''} ${className ?? ''}`}
|
43
43
|
variant="link"
|
44
|
-
aria-label={props['aria-label'] || 'Stop
|
44
|
+
aria-label={props['aria-label'] || 'Stop'}
|
45
45
|
onClick={onClick}
|
46
46
|
icon={
|
47
47
|
<Icon iconSize={isCompact ? 'lg' : 'xl'} isInline>
|
@@ -7,20 +7,20 @@ import userEvent from '@testing-library/user-event';
|
|
7
7
|
describe('JumpButton', () => {
|
8
8
|
it('should render top button correctly', () => {
|
9
9
|
render(<JumpButton position="top" onClick={jest.fn()} />);
|
10
|
-
expect(screen.getByRole('button', { name: /Jump top
|
10
|
+
expect(screen.getByRole('button', { name: /Jump top/i })).toBeTruthy();
|
11
11
|
});
|
12
12
|
it('should render bottom button correctly', () => {
|
13
13
|
render(<JumpButton position="bottom" onClick={jest.fn()} />);
|
14
|
-
expect(screen.getByRole('button', { name: /Jump bottom
|
14
|
+
expect(screen.getByRole('button', { name: /Jump bottom/i })).toBeTruthy();
|
15
15
|
});
|
16
16
|
it('should call onClick appropriately', async () => {
|
17
17
|
const spy = jest.fn();
|
18
18
|
render(<JumpButton position="bottom" onClick={spy} />);
|
19
|
-
await userEvent.click(screen.getByRole('button', { name: /Jump bottom
|
19
|
+
await userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
|
20
20
|
expect(spy).toHaveBeenCalledTimes(1);
|
21
21
|
});
|
22
22
|
it('should be hidden if isHidden prop is used', async () => {
|
23
23
|
render(<JumpButton position="bottom" onClick={jest.fn()} isHidden />);
|
24
|
-
expect(screen.queryByRole('button', { name: /Jump bottom
|
24
|
+
expect(screen.queryByRole('button', { name: /Jump bottom/i })).toBeFalsy();
|
25
25
|
});
|
26
26
|
});
|
@@ -24,7 +24,7 @@ const JumpButton: React.FunctionComponent<JumpButtonProps> = ({ position, isHidd
|
|
24
24
|
<Button
|
25
25
|
variant="plain"
|
26
26
|
className={`pf-chatbot__jump pf-chatbot__jump--${position}`}
|
27
|
-
aria-label={`Jump ${position}
|
27
|
+
aria-label={`Jump ${position}`}
|
28
28
|
onClick={onClick}
|
29
29
|
>
|
30
30
|
<Icon iconSize="lg" isInline>
|
@@ -40,7 +40,7 @@ describe('MessageBox', () => {
|
|
40
40
|
region.dispatchEvent(new Event('scroll'));
|
41
41
|
|
42
42
|
await waitFor(() => {
|
43
|
-
userEvent.click(screen.getByRole('button', { name: /Jump bottom
|
43
|
+
userEvent.click(screen.getByRole('button', { name: /Jump bottom/i }));
|
44
44
|
expect(spy).toHaveBeenCalled();
|
45
45
|
});
|
46
46
|
});
|
@@ -63,7 +63,7 @@ describe('MessageBox', () => {
|
|
63
63
|
region.dispatchEvent(new Event('scroll'));
|
64
64
|
|
65
65
|
await waitFor(() => {
|
66
|
-
userEvent.click(screen.getByRole('button', { name: /Jump top
|
66
|
+
userEvent.click(screen.getByRole('button', { name: /Jump top/i }));
|
67
67
|
expect(spy).toHaveBeenCalled();
|
68
68
|
});
|
69
69
|
});
|