Skip to content

Commit 21a4c3e

Browse files
OEvgenyEugene Olonov
andauthored
Hide the send box of the Fluent theme when hideSendBox is set (#5918)
* Fix Fluent theme ignoring styleOptions.hideSendBox * Add PR number to changelog * Move the changelog entry to .changelog/ * Update Fluent forced colors snapshots now that hideSendBox hides the send box The forced colors tests from #5907 share pages that render Web Chat with `styleOptions: { hideSendBox: true }`. Their Fluent snapshots were captured before the Fluent theme honored `hideSendBox`, so they still showed the send box. With the send box hidden, the messages sit 90px lower; nothing else changes. --------- Co-authored-by: Eugene Olonov <eugeneolonov@microsoft.com>
1 parent 0f4abdb commit 21a4c3e

13 files changed

Lines changed: 98 additions & 2 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Fixed
2+
3+
- Fixed the Fluent theme ignoring `styleOptions.hideSendBox`, in PR [#5918](https://github.com/microsoft/BotFramework-WebChat/pull/5918), by [@OEvgeny](https://github.com/OEvgeny)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script>
5+
location = './hideSendBox?variant=copilot';
6+
</script>
7+
</head>
8+
<body></body>
9+
</html>
4.77 KB
Loading
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!doctype html>
2+
<html lang="en-US">
3+
<head>
4+
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
</head>
6+
<body>
7+
<main id="webchat"></main>
8+
<script type="importmap">
9+
{
10+
"imports": {
11+
"@testduet/wait-for": "https://esm.sh/@testduet/wait-for",
12+
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
13+
"botframework-webchat/": "/__dist__/packages/bundle/static/botframework-webchat/",
14+
"botframework-webchat-fluent-theme": "/__dist__/packages/fluent-theme/static/botframework-webchat-fluent-theme.js",
15+
"react": "/__dist__/packages/bundle/static/react.js",
16+
"react-dom": "/__dist__/packages/bundle/static/react-dom.js",
17+
"react-dom/client": "/__dist__/packages/bundle/static/react-dom/client.js"
18+
}
19+
}
20+
</script>
21+
<script type="module">
22+
import '/test-harness.mjs';
23+
import '/test-page-object.mjs';
24+
25+
import { waitFor } from '@testduet/wait-for';
26+
import { createStoreWithOptions, ReactWebChat } from 'botframework-webchat';
27+
import { FluentThemeProvider, testIds } from 'botframework-webchat-fluent-theme';
28+
import { createElement } from 'react';
29+
import { createRoot } from 'react-dom/client';
30+
31+
// TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line.
32+
window.WebChat = { createStoreWithOptions };
33+
34+
run(async function () {
35+
const { directLine, store } = testHelpers.createDirectLineEmulator();
36+
37+
// GIVEN: Web Chat with the Fluent theme (or its Copilot variant) and `hideSendBox: true`.
38+
createRoot(document.getElementById('webchat')).render(
39+
createElement(
40+
FluentThemeProvider,
41+
{ variant: new URLSearchParams(location.search).get('variant') || 'fluent' },
42+
createElement(ReactWebChat, { directLine, store, styleOptions: { hideSendBox: true } })
43+
)
44+
);
45+
46+
await pageConditions.uiConnected();
47+
48+
// WHEN: The bot sends a message with suggested actions, which are shown inside the send box.
49+
await directLine.emulateIncomingActivity({
50+
from: { role: 'bot' },
51+
suggestedActions: {
52+
actions: [
53+
{ title: 'Yes', type: 'imBack', value: 'Yes' },
54+
{ title: 'No', type: 'imBack', value: 'No' }
55+
]
56+
},
57+
text: 'Do you want to continue?',
58+
type: 'message'
59+
});
60+
61+
await pageConditions.numActivitiesShown(1);
62+
await waitFor(() => expect(store.getState().suggestedActions).toHaveLength(2));
63+
64+
// THEN: The send box, its toolbar, and the suggested actions should not be rendered.
65+
expect(pageElements.byTestId(testIds.sendBoxContainer)).toBeFalsy();
66+
expect(pageElements.byTestId(testIds.sendBoxTextBox)).toBeFalsy();
67+
expect(pageElements.byTestId(testIds.sendBoxSendButton)).toBeFalsy();
68+
expect(pageElements.byTestId(testIds.sendBoxSuggestedAction)).toBeFalsy();
69+
70+
// THEN: The transcript shows the message, without a send box or suggested actions below it.
71+
await host.snapshot('local');
72+
});
73+
</script>
74+
</body>
75+
</html>
5.58 KB
Loading
-3.27 KB
Loading
-3.23 KB
Loading
-3.32 KB
Loading
-3.28 KB
Loading
-3.32 KB
Loading

0 commit comments

Comments
 (0)