Skip to content

Commit d004a15

Browse files
OEvgenyCopilot
andauthored
feat: Add style option to configure default group and references open state (microsoft#5771)
* WIP: Add style option to configure default group open state * Add "open group" step to copilot variant tests; revert for flaky adaptive card test (microsoft#5772) * Initial plan * Add opening group action to copilot test files before first snapshot Co-authored-by: OEvgeny <2841858+OEvgeny@users.noreply.github.com> * Revert opening group action from custom.skip.html (flaky test) Co-authored-by: OEvgeny <2841858+OEvgeny@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: OEvgeny <2841858+OEvgeny@users.noreply.github.com> * Changelog * Fix tests * Add references visibility style option * Better naming * Fix tests * Rename to referenceListDefaultOpen * fix remaining --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: OEvgeny <2841858+OEvgeny@users.noreply.github.com>
1 parent 4fc8b96 commit d004a15

34 files changed

+198
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ Breaking changes in this release:
102102
- Resolved [#5463](https://github.com/microsoft/BotFramework-WebChat/issues/5463). Added attachment preview for `sendAttachmentOn: "send"`, in PR [#5464](https://github.com/microsoft/BotFramework-WebChat/pull/5464), by [@compulim](https://github.com/compulim), in PR [#5492](https://github.com/microsoft/BotFramework-WebChat/pull/5492), by [@OEvgeny](https://github.com/OEvgeny)
103103
- Attaching files will no longer remove previously attached files
104104
- Updated Fluent theme to use the new attachment preview feature
105-
- Added collapsible activity and activity with abstract handling, in PR [#5506](https://github.com/microsoft/BotFramework-WebChat/pull/5506), in PR [#5513](https://github.com/microsoft/BotFramework-WebChat/pull/5513), by [@OEvgeny](https://github.com/OEvgeny)
105+
- Added collapsible activity and activity with abstract handling, in PR [#5506](https://github.com/microsoft/BotFramework-WebChat/pull/5506), in PR [#5513](https://github.com/microsoft/BotFramework-WebChat/pull/5513), in PR [#5771](https://github.com/microsoft/BotFramework-WebChat/pull/5771), by [@OEvgeny](https://github.com/OEvgeny)
106+
- Added `styleOptions.partGroupDefaultOpen` to configure whether part groups are open by default, defaults to `true`
107+
- Added `styleOptions.referenceListDefaultOpen` to configure whether references are open by default, defaults to `true`
108+
- In the Fluent theme "copilot" variant, part groups and references now default to closed
106109
- Added `disableFileUpload` flag to completelly disable file upload feature, in PR [#5508](https://github.com/microsoft/BotFramework-WebChat/pull/5508), by [@JamesNewbyAtMicrosoft](https://github.com/JamesNewbyAtMicrosoft)
107110
- Deprecated `hideUploadButton` in favor of `disableFileUpload`.
108111
- Updated `BasicSendBoxToolbar` to rely solely on `disableFileUpload`.
-6.18 KB
Loading
27.1 KB
Loading

__tests__/html2/activity/citation.longRef.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
run(async function () {
1616
const { directLine, store } = testHelpers.createDirectLineEmulator();
1717

18-
renderWebChat(
18+
const { isCopilotVariant } = renderWebChat(
1919
{
2020
directLine,
2121
store
@@ -70,6 +70,14 @@
7070

7171
expect(markdownButtons[0].getAttribute('type')).toBe('button');
7272

73+
// When (copilot): opening the link definitions
74+
if (isCopilotVariant) {
75+
await host.click(pageElements.linkDefinitions()[0].querySelector('summary'));
76+
77+
// Then (copilot): the link definitions should be opened
78+
await host.snapshot('local');
79+
}
80+
7381
const linkDefinitionItems = pageElements.linkDefinitions()[0].querySelectorAll('[role="listitem"] > *');
7482

7583
expect(linkDefinitionItems[0].getAttribute('href')).toBe(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Citation accordion (copilot)</title>
5+
<script>
6+
location = './accordion?variant=copilot';
7+
</script>
8+
</head>
9+
<body></body>
10+
</html>
13.3 KB
Loading
18.3 KB
Loading
13.3 KB
Loading

__tests__/html2/citation/accordion.html

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,66 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en-US">
33
<head>
44
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<script type="importmap">
6+
{
7+
"imports": {
8+
"@fluentui/react-provider": "/__dist__/packages/test/test-assets/out/@fluentui/react-provider.js",
9+
"@fluentui/tokens": "/__dist__/packages/test/test-assets/out/@fluentui/tokens.js",
10+
"react": "https://esm.sh/react@18",
11+
"react-dom": "https://esm.sh/react-dom@18",
12+
"react-dom/": "https://esm.sh/react-dom@18/",
13+
"react-jsx-runtime": "https://esm.sh/react@18/jsx-runtime"
14+
}
15+
}
16+
</script>
517
<script crossorigin="anonymous" src="/test-harness.js"></script>
618
<script crossorigin="anonymous" src="/test-page-object.js"></script>
7-
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
19+
<script type="module">
20+
import React from 'react';
21+
window.React = React;
22+
</script>
23+
<script defer crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
24+
<script defer crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script>
25+
<style type="text/css">
26+
.fui-FluentProvider {
27+
height: 100%;
28+
}
29+
</style>
830
</head>
931
<body>
1032
<main id="webchat"></main>
11-
<script>
33+
<script type="module">
34+
import { FluentProvider } from '@fluentui/react-provider';
35+
import { webLightTheme } from '@fluentui/tokens';
36+
import React from 'react';
37+
import { createRoot } from 'react-dom/client';
38+
1239
run(async function () {
40+
const {
41+
WebChat: { FluentThemeProvider, ReactWebChat }
42+
} = window;
43+
1344
const { directLine, store } = testHelpers.createDirectLineEmulator();
1445

15-
WebChat.renderWebChat(
16-
{
17-
directLine,
18-
store
19-
},
20-
document.getElementById('webchat')
46+
const searchParams = new URLSearchParams(location.search);
47+
const variant = searchParams.get('variant');
48+
49+
if (variant) {
50+
window.checkAccessibility = async () => {};
51+
}
52+
53+
const root = createRoot(document.getElementById('webchat'));
54+
const webChatProps = { directLine, store };
55+
56+
root.render(
57+
variant
58+
? React.createElement(
59+
FluentProvider,
60+
{ className: 'fui-FluentProvider', theme: webLightTheme },
61+
React.createElement(FluentThemeProvider, { variant }, React.createElement(ReactWebChat, webChatProps))
62+
)
63+
: React.createElement(ReactWebChat, webChatProps)
2164
);
2265

2366
await pageConditions.uiConnected();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Citation show modal link definitions (copilot)</title>
5+
<script>
6+
location = './showModal.linkDefinitions?variant=copilot';
7+
</script>
8+
</head>
9+
<body></body>
10+
</html>

0 commit comments

Comments
 (0)