-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathfluentTheme.html
More file actions
103 lines (91 loc) · 4.24 KB
/
fluentTheme.html
File metadata and controls
103 lines (91 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
<script crossorigin="anonymous" src="/test-harness.js"></script>
<script crossorigin="anonymous" src="/test-page-object.js"></script>
<style type="text/css">
/* TODO: [P*] Can we eliminate this style? */
.fui-FluentProvider,
.webchat-fluent {
height: 100%;
}
</style>
</head>
<body>
<main id="webchat"></main>
<!-- Redirect packages on esm.sh loaded by `@fluentui/react-components` -->
<script type="importmap">
{
"imports": {
"@fluentui/react-components": "https://esm.sh/@fluentui/react-components?deps=react@18.3.1,react-dom@18.3.1&exports=FluentProvider,createDarkTheme,webLightTheme",
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
"botframework-webchat/decorator": "/__dist__/packages/bundle/static/botframework-webchat.decorator.js",
"botframework-webchat/internal": "/__dist__/packages/bundle/static/botframework-webchat.internal.js",
"botframework-webchat-fluent-theme": "/__dist__/packages/fluent-theme/static/botframework-webchat-fluent-theme.js",
"jest-mock": "https://esm.sh/jest-mock",
"react": "/__dist__/packages/bundle/static/react.18.js",
"react-dom": "/__dist__/packages/bundle/static/react-dom.18.js",
"react-dom/client": "/__dist__/packages/bundle/static/react-dom.18/client.js",
"https://esm.sh/react@18.3.1/es2022/react.mjs": "/__dist__/packages/bundle/static/react.18.js",
"https://esm.sh/react@18.3.1/es2022/react-dom.mjs": "/__dist__/packages/bundle/static/react-dom.18.js",
"https://esm.sh/react@18.3.1/es2022/react-dom/client.mjs": "/__dist__/packages/bundle/static/react-dom.18/client.js"
}
}
</script>
<script type="module">
import { fn, spyOn } from 'jest-mock';
import { FluentProvider, webLightTheme } from '@fluentui/react-components';
import { createDirectLine, createStoreWithOptions, hooks, ReactWebChat } from 'botframework-webchat';
import { FluentThemeProvider } from 'botframework-webchat-fluent-theme';
import { createElement } from 'react';
import { createRoot } from 'react-dom/client';
const consoleError = console.error.bind(console);
spyOn(console, 'error').mockImplementation((...args) => {
const [message] = args;
if (
!(
typeof message === 'string' &&
(message.includes(
'Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.'
) ||
// TODO: [P0] We should fix the "Cannot update a component while rendering a different component" error.
(message.includes('Cannot update a component') &&
message.includes('while rendering a different component')))
)
) {
consoleError(...args);
}
});
const { useStyleOptions } = hooks;
const {
testHelpers: { createDirectLineEmulator }
} = window;
// TODO: This is for `createDirectLineEmulator` only, should find ways to eliminate this line.
window.WebChat = { createStoreWithOptions };
run(async function () {
const { directLine, store } = createDirectLineEmulator();
const fluentTheme = {
...webLightTheme,
// Original is #242424 which is too light for fui-FluentProvider to pass our accessibility checks.
colorNeutralForeground1: '#1b1b1b'
};
createRoot(document.getElementsByTagName('main')[0]).render(
createElement(
FluentProvider,
{ className: 'fui-FluentProvider', theme: fluentTheme },
createElement(
FluentThemeProvider,
{ variant: 'fluent' },
createElement(ReactWebChat, { directLine, store })
)
)
);
await pageConditions.uiConnected();
await directLine.emulateIncomingActivity('Hello, World!');
await pageConditions.numActivitiesShown(1);
await host.snapshot('local');
});
</script>
</body>
</html>