-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathuseFocus.sendBox.pure.html
More file actions
52 lines (43 loc) · 1.72 KB
/
useFocus.sendBox.pure.html
File metadata and controls
52 lines (43 loc) · 1.72 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
<!doctype html>
<html lang="en-US">
<head>
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<main id="webchat"></main>
<script type="importmap">
{
"imports": {
"botframework-webchat": "/__dist__/packages/bundle/static/botframework-webchat.js",
"botframework-webchat/component": "/__dist__/packages/bundle/static/botframework-webchat/component.js",
"botframework-webchat/hook": "/__dist__/packages/bundle/static/botframework-webchat/hook.js",
"react": "https://esm.sh/react@18",
"react-dom": "https://esm.sh/react-dom@18",
"react-dom/": "https://esm.sh/react-dom@18/"
}
}
</script>
<script type="module">
import '/test-harness.mjs';
import '/test-page-object.mjs';
import { createStoreWithOptions, testIds } from 'botframework-webchat';
import { useFocus } from 'botframework-webchat/hook';
import createRenderHook from '/assets/esm/createRenderHook.js';
const { createDirectLineEmulator } = window.testHelpers;
window.WebChat = { createStoreWithOptions, testIds };
run(async function () {
const { directLine, store } = createDirectLineEmulator();
const renderHook = createRenderHook(
document.getElementById('webchat'),
{ directLine, store },
{ renderWebChat: true }
);
await renderHook();
expect(document.activeElement === pageElements.sendBoxTextBox()).toBe(false);
const focus = await renderHook(() => useFocus());
await focus('sendBox');
expect(document.activeElement === pageElements.sendBoxTextBox()).toBe(true);
});
</script>
</body>
</html>