@patternfly/chatbot 6.3.0-prerelease.12 → 6.3.0-prerelease.13
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/MessageBar/MessageBar.js +6 -6
- package/dist/cjs/MessageBar/MessageBar.test.js +20 -0
- package/dist/esm/MessageBar/MessageBar.js +6 -6
- package/dist/esm/MessageBar/MessageBar.test.js +20 -0
- package/package.json +1 -1
- package/src/MessageBar/MessageBar.test.tsx +45 -0
- package/src/MessageBar/MessageBar.tsx +5 -0
@@ -175,15 +175,15 @@ const MessageBar = (_a) => {
|
|
175
175
|
onChange && onChange({}, message);
|
176
176
|
};
|
177
177
|
const renderButtons = () => {
|
178
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
178
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
179
179
|
if (hasStopButton && handleStopButton) {
|
180
|
-
return (react_1.default.createElement(StopButton_1.default, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact
|
180
|
+
return (react_1.default.createElement(StopButton_1.default, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact, tooltipProps: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.tooltipProps }, (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _c === void 0 ? void 0 : _c.props)));
|
181
181
|
}
|
182
182
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
183
|
-
attachMenuProps && (react_1.default.createElement(AttachButton_1.AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (
|
184
|
-
!attachMenuProps && hasAttachButton && (react_1.default.createElement(AttachButton_1.AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (
|
185
|
-
hasMicrophoneButton && (react_1.default.createElement(MicrophoneButton_1.default, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (
|
186
|
-
(alwayShowSendButton || message) && (react_1.default.createElement(SendButton_1.default, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (
|
183
|
+
attachMenuProps && (react_1.default.createElement(AttachButton_1.AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.tooltipContent, isCompact: isCompact, tooltipProps: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipProps }, (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.props))),
|
184
|
+
!attachMenuProps && hasAttachButton && (react_1.default.createElement(AttachButton_1.AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.tooltipContent, inputTestId: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _h === void 0 ? void 0 : _h.inputTestId, isCompact: isCompact, tooltipProps: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _j === void 0 ? void 0 : _j.tooltipProps }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _k === void 0 ? void 0 : _k.props))),
|
185
|
+
hasMicrophoneButton && (react_1.default.createElement(MicrophoneButton_1.default, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _l === void 0 ? void 0 : _l.tooltipContent, language: (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _m === void 0 ? void 0 : _m.language, isCompact: isCompact, tooltipProps: (_o = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _o === void 0 ? void 0 : _o.tooltipProps }, (_p = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _p === void 0 ? void 0 : _p.props))),
|
186
|
+
(alwayShowSendButton || message) && (react_1.default.createElement(SendButton_1.default, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_q = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _q === void 0 ? void 0 : _q.tooltipContent, isCompact: isCompact, tooltipProps: (_r = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _r === void 0 ? void 0 : _r.tooltipProps }, (_s = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _s === void 0 ? void 0 : _s.props)))));
|
187
187
|
};
|
188
188
|
const messageBarContents = (react_1.default.createElement(react_1.default.Fragment, null,
|
189
189
|
react_1.default.createElement("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}` },
|
@@ -125,6 +125,11 @@ describe('Message bar', () => {
|
|
125
125
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Send' }));
|
126
126
|
expect(react_2.screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
127
127
|
}));
|
128
|
+
it('can handle buttonProps tooltipProps appropriately for send', () => {
|
129
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { tooltipProps: { isVisible: true } } } }));
|
130
|
+
// isVisible, so no need for click
|
131
|
+
expect(react_2.screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
|
132
|
+
});
|
128
133
|
it('can handle buttonProps props appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
|
129
134
|
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { props: { 'aria-label': 'Test' } } } }));
|
130
135
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Test' }));
|
@@ -189,6 +194,11 @@ describe('Message bar', () => {
|
|
189
194
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Attach' }));
|
190
195
|
expect(react_2.screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
191
196
|
}));
|
197
|
+
it('can handle buttonProps tooltipProps appropriately for attach', () => {
|
198
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { attach: { tooltipProps: { isVisible: true } } } }));
|
199
|
+
// isVisible, so no need for click
|
200
|
+
expect(react_2.screen.getByRole('tooltip', { name: 'Attach' })).toBeTruthy();
|
201
|
+
});
|
192
202
|
it('can handle buttonProps props appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
|
193
203
|
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: { attach: { props: { 'aria-label': 'Test' } } } }));
|
194
204
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Test' }));
|
@@ -210,6 +220,11 @@ describe('Message bar', () => {
|
|
210
220
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Stop' }));
|
211
221
|
expect(react_2.screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
212
222
|
}));
|
223
|
+
it('can handle buttonProps tooltipProps appropriately for stop', () => {
|
224
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { tooltipProps: { isVisible: true } } } }));
|
225
|
+
// isVisible, so no need for click
|
226
|
+
expect(react_2.screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
|
227
|
+
});
|
213
228
|
it('can handle buttonProps props appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
|
214
229
|
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { props: { 'aria-label': 'Test' } } } }));
|
215
230
|
yield user_event_1.default.click(react_2.screen.getByRole('button', { name: 'Test' }));
|
@@ -242,6 +257,11 @@ describe('Message bar', () => {
|
|
242
257
|
const input = react_2.screen.getByRole('textbox', { name: /I am listening/i });
|
243
258
|
expect(input).toBeTruthy();
|
244
259
|
}));
|
260
|
+
it('can handle buttonProps tooltipProps appropriately for microphone', () => {
|
261
|
+
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { tooltipProps: { isVisible: true } } } }));
|
262
|
+
// isVisible, so no need for click
|
263
|
+
expect(react_2.screen.getByRole('tooltip', { name: 'Use microphone' })).toBeTruthy();
|
264
|
+
});
|
245
265
|
it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
|
246
266
|
mockSpeechRecognition();
|
247
267
|
(0, react_2.render)(react_1.default.createElement(MessageBar_1.MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
|
@@ -169,15 +169,15 @@ export const MessageBar = (_a) => {
|
|
169
169
|
onChange && onChange({}, message);
|
170
170
|
};
|
171
171
|
const renderButtons = () => {
|
172
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
172
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
173
173
|
if (hasStopButton && handleStopButton) {
|
174
|
-
return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact
|
174
|
+
return (React.createElement(StopButton, Object.assign({ onClick: handleStopButton, tooltipContent: (_a = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _a === void 0 ? void 0 : _a.tooltipContent, isCompact: isCompact, tooltipProps: (_b = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _b === void 0 ? void 0 : _b.tooltipProps }, (_c = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.stop) === null || _c === void 0 ? void 0 : _c.props)));
|
175
175
|
}
|
176
176
|
return (React.createElement(React.Fragment, null,
|
177
|
-
attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (
|
178
|
-
!attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (
|
179
|
-
hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (
|
180
|
-
(alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (
|
177
|
+
attachMenuProps && (React.createElement(AttachButton, Object.assign({ ref: attachButtonRef, onClick: handleAttachMenuToggle, isDisabled: isListeningMessage, tooltipContent: (_d = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _d === void 0 ? void 0 : _d.tooltipContent, isCompact: isCompact, tooltipProps: (_e = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _e === void 0 ? void 0 : _e.tooltipProps }, (_f = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _f === void 0 ? void 0 : _f.props))),
|
178
|
+
!attachMenuProps && hasAttachButton && (React.createElement(AttachButton, Object.assign({ onAttachAccepted: handleAttach, isDisabled: isListeningMessage, tooltipContent: (_g = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _g === void 0 ? void 0 : _g.tooltipContent, inputTestId: (_h = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _h === void 0 ? void 0 : _h.inputTestId, isCompact: isCompact, tooltipProps: (_j = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _j === void 0 ? void 0 : _j.tooltipProps }, (_k = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.attach) === null || _k === void 0 ? void 0 : _k.props))),
|
179
|
+
hasMicrophoneButton && (React.createElement(MicrophoneButton, Object.assign({ isListening: isListeningMessage, onIsListeningChange: setIsListeningMessage, onSpeechRecognition: handleSpeechRecognition, tooltipContent: (_l = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _l === void 0 ? void 0 : _l.tooltipContent, language: (_m = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _m === void 0 ? void 0 : _m.language, isCompact: isCompact, tooltipProps: (_o = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _o === void 0 ? void 0 : _o.tooltipProps }, (_p = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.microphone) === null || _p === void 0 ? void 0 : _p.props))),
|
180
|
+
(alwayShowSendButton || message) && (React.createElement(SendButton, Object.assign({ value: message, onClick: () => handleSend(message), isDisabled: isSendButtonDisabled, tooltipContent: (_q = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _q === void 0 ? void 0 : _q.tooltipContent, isCompact: isCompact, tooltipProps: (_r = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _r === void 0 ? void 0 : _r.tooltipProps }, (_s = buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.send) === null || _s === void 0 ? void 0 : _s.props)))));
|
181
181
|
};
|
182
182
|
const messageBarContents = (React.createElement(React.Fragment, null,
|
183
183
|
React.createElement("div", { className: `pf-chatbot__message-bar-input ${isCompact ? 'pf-m-compact' : ''}` },
|
@@ -120,6 +120,11 @@ describe('Message bar', () => {
|
|
120
120
|
yield userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
121
121
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
122
122
|
}));
|
123
|
+
it('can handle buttonProps tooltipProps appropriately for send', () => {
|
124
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { tooltipProps: { isVisible: true } } } }));
|
125
|
+
// isVisible, so no need for click
|
126
|
+
expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
|
127
|
+
});
|
123
128
|
it('can handle buttonProps props appropriately for send', () => __awaiter(void 0, void 0, void 0, function* () {
|
124
129
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { send: { props: { 'aria-label': 'Test' } } } }));
|
125
130
|
yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
|
@@ -184,6 +189,11 @@ describe('Message bar', () => {
|
|
184
189
|
yield userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
185
190
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
186
191
|
}));
|
192
|
+
it('can handle buttonProps tooltipProps appropriately for attach', () => {
|
193
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, alwayShowSendButton: true, buttonProps: { attach: { tooltipProps: { isVisible: true } } } }));
|
194
|
+
// isVisible, so no need for click
|
195
|
+
expect(screen.getByRole('tooltip', { name: 'Attach' })).toBeTruthy();
|
196
|
+
});
|
187
197
|
it('can handle buttonProps props appropriately for attach', () => __awaiter(void 0, void 0, void 0, function* () {
|
188
198
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasAttachButton: true, buttonProps: { attach: { props: { 'aria-label': 'Test' } } } }));
|
189
199
|
yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
|
@@ -205,6 +215,11 @@ describe('Message bar', () => {
|
|
205
215
|
yield userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
206
216
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
207
217
|
}));
|
218
|
+
it('can handle buttonProps tooltipProps appropriately for stop', () => {
|
219
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { tooltipProps: { isVisible: true } } } }));
|
220
|
+
// isVisible, so no need for click
|
221
|
+
expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
|
222
|
+
});
|
208
223
|
it('can handle buttonProps props appropriately for stop', () => __awaiter(void 0, void 0, void 0, function* () {
|
209
224
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasStopButton: true, handleStopButton: jest.fn, buttonProps: { stop: { props: { 'aria-label': 'Test' } } } }));
|
210
225
|
yield userEvent.click(screen.getByRole('button', { name: 'Test' }));
|
@@ -237,6 +252,11 @@ describe('Message bar', () => {
|
|
237
252
|
const input = screen.getByRole('textbox', { name: /I am listening/i });
|
238
253
|
expect(input).toBeTruthy();
|
239
254
|
}));
|
255
|
+
it('can handle buttonProps tooltipProps appropriately for microphone', () => {
|
256
|
+
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { tooltipProps: { isVisible: true } } } }));
|
257
|
+
// isVisible, so no need for click
|
258
|
+
expect(screen.getByRole('tooltip', { name: 'Use microphone' })).toBeTruthy();
|
259
|
+
});
|
240
260
|
it('can handle buttonProps props appropriately for microphone', () => __awaiter(void 0, void 0, void 0, function* () {
|
241
261
|
mockSpeechRecognition();
|
242
262
|
render(React.createElement(MessageBar, { onSendMessage: jest.fn, hasMicrophoneButton: true, buttonProps: { microphone: { props: { 'aria-label': 'Test' } } } }));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@patternfly/chatbot",
|
3
|
-
"version": "6.3.0-prerelease.
|
3
|
+
"version": "6.3.0-prerelease.13",
|
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",
|
@@ -148,6 +148,17 @@ describe('Message bar', () => {
|
|
148
148
|
await userEvent.click(screen.getByRole('button', { name: 'Send' }));
|
149
149
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
150
150
|
});
|
151
|
+
it('can handle buttonProps tooltipProps appropriately for send', () => {
|
152
|
+
render(
|
153
|
+
<MessageBar
|
154
|
+
onSendMessage={jest.fn}
|
155
|
+
alwayShowSendButton
|
156
|
+
buttonProps={{ send: { tooltipProps: { isVisible: true } } }}
|
157
|
+
/>
|
158
|
+
);
|
159
|
+
// isVisible, so no need for click
|
160
|
+
expect(screen.getByRole('tooltip', { name: 'Send' })).toBeTruthy();
|
161
|
+
});
|
151
162
|
it('can handle buttonProps props appropriately for send', async () => {
|
152
163
|
render(
|
153
164
|
<MessageBar
|
@@ -236,6 +247,17 @@ describe('Message bar', () => {
|
|
236
247
|
await userEvent.click(screen.getByRole('button', { name: 'Attach' }));
|
237
248
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
238
249
|
});
|
250
|
+
it('can handle buttonProps tooltipProps appropriately for attach', () => {
|
251
|
+
render(
|
252
|
+
<MessageBar
|
253
|
+
onSendMessage={jest.fn}
|
254
|
+
alwayShowSendButton
|
255
|
+
buttonProps={{ attach: { tooltipProps: { isVisible: true } } }}
|
256
|
+
/>
|
257
|
+
);
|
258
|
+
// isVisible, so no need for click
|
259
|
+
expect(screen.getByRole('tooltip', { name: 'Attach' })).toBeTruthy();
|
260
|
+
});
|
239
261
|
it('can handle buttonProps props appropriately for attach', async () => {
|
240
262
|
render(
|
241
263
|
<MessageBar
|
@@ -271,6 +293,18 @@ describe('Message bar', () => {
|
|
271
293
|
await userEvent.click(screen.getByRole('button', { name: 'Stop' }));
|
272
294
|
expect(screen.getByRole('tooltip', { name: 'Test' })).toBeTruthy();
|
273
295
|
});
|
296
|
+
it('can handle buttonProps tooltipProps appropriately for stop', () => {
|
297
|
+
render(
|
298
|
+
<MessageBar
|
299
|
+
onSendMessage={jest.fn}
|
300
|
+
hasStopButton
|
301
|
+
handleStopButton={jest.fn}
|
302
|
+
buttonProps={{ stop: { tooltipProps: { isVisible: true } } }}
|
303
|
+
/>
|
304
|
+
);
|
305
|
+
// isVisible, so no need for click
|
306
|
+
expect(screen.getByRole('tooltip', { name: 'Stop' })).toBeTruthy();
|
307
|
+
});
|
274
308
|
it('can handle buttonProps props appropriately for stop', async () => {
|
275
309
|
render(
|
276
310
|
<MessageBar
|
@@ -317,6 +351,17 @@ describe('Message bar', () => {
|
|
317
351
|
const input = screen.getByRole('textbox', { name: /I am listening/i });
|
318
352
|
expect(input).toBeTruthy();
|
319
353
|
});
|
354
|
+
it('can handle buttonProps tooltipProps appropriately for microphone', () => {
|
355
|
+
render(
|
356
|
+
<MessageBar
|
357
|
+
onSendMessage={jest.fn}
|
358
|
+
hasMicrophoneButton
|
359
|
+
buttonProps={{ microphone: { tooltipProps: { isVisible: true } } }}
|
360
|
+
/>
|
361
|
+
);
|
362
|
+
// isVisible, so no need for click
|
363
|
+
expect(screen.getByRole('tooltip', { name: 'Use microphone' })).toBeTruthy();
|
364
|
+
});
|
320
365
|
it('can handle buttonProps props appropriately for microphone', async () => {
|
321
366
|
mockSpeechRecognition();
|
322
367
|
render(
|
@@ -279,6 +279,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
279
279
|
onClick={handleStopButton}
|
280
280
|
tooltipContent={buttonProps?.stop?.tooltipContent}
|
281
281
|
isCompact={isCompact}
|
282
|
+
tooltipProps={buttonProps?.stop?.tooltipProps}
|
282
283
|
{...buttonProps?.stop?.props}
|
283
284
|
/>
|
284
285
|
);
|
@@ -292,6 +293,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
292
293
|
isDisabled={isListeningMessage}
|
293
294
|
tooltipContent={buttonProps?.attach?.tooltipContent}
|
294
295
|
isCompact={isCompact}
|
296
|
+
tooltipProps={buttonProps?.attach?.tooltipProps}
|
295
297
|
{...buttonProps?.attach?.props}
|
296
298
|
/>
|
297
299
|
)}
|
@@ -302,6 +304,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
302
304
|
tooltipContent={buttonProps?.attach?.tooltipContent}
|
303
305
|
inputTestId={buttonProps?.attach?.inputTestId}
|
304
306
|
isCompact={isCompact}
|
307
|
+
tooltipProps={buttonProps?.attach?.tooltipProps}
|
305
308
|
{...buttonProps?.attach?.props}
|
306
309
|
/>
|
307
310
|
)}
|
@@ -313,6 +316,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
313
316
|
tooltipContent={buttonProps?.microphone?.tooltipContent}
|
314
317
|
language={buttonProps?.microphone?.language}
|
315
318
|
isCompact={isCompact}
|
319
|
+
tooltipProps={buttonProps?.microphone?.tooltipProps}
|
316
320
|
{...buttonProps?.microphone?.props}
|
317
321
|
/>
|
318
322
|
)}
|
@@ -323,6 +327,7 @@ export const MessageBar: React.FunctionComponent<MessageBarProps> = ({
|
|
323
327
|
isDisabled={isSendButtonDisabled}
|
324
328
|
tooltipContent={buttonProps?.send?.tooltipContent}
|
325
329
|
isCompact={isCompact}
|
330
|
+
tooltipProps={buttonProps?.send?.tooltipProps}
|
326
331
|
{...buttonProps?.send?.props}
|
327
332
|
/>
|
328
333
|
)}
|