Skip to content

Commit 0f9061b

Browse files
author
Eugene Olonov
committed
Show the live region copy in role mod snapshots
1 parent 63ae058 commit 0f9061b

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎__tests__/html2/accessibility/adaptiveCard/hack.roleMod.html‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<html lang="en-US">
33
<head>
44
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<!-- Shows the live region, so the snapshot shows the copy sent to screen readers. -->
6+
<link href="/assets/accessibility.liveRegionAttachment.css" rel="stylesheet" type="text/css" />
57
<script crossorigin="anonymous" src="/test-harness.js"></script>
68
<script crossorigin="anonymous" src="/test-page-object.js"></script>
79
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
@@ -12,7 +14,11 @@
1214
run(async function () {
1315
const { directLine, store } = testHelpers.createDirectLineEmulator();
1416

15-
WebChat.renderWebChat({ directLine, store }, document.getElementById('webchat'));
17+
// GIVEN: Web Chat keeps the live region copy of new messages, so it can be seen in the snapshot.
18+
WebChat.renderWebChat(
19+
{ directLine, store, styleOptions: { hideSendBox: true, internalLiveRegionFadeAfter: 60000 } },
20+
document.getElementById('webchat')
21+
);
1622

1723
await pageConditions.uiConnected();
1824

@@ -66,6 +72,11 @@
6672

6773
expect(secondAdaptiveCard.getAttribute('aria-label')).toBeTruthy();
6874
expect(secondAdaptiveCard.getAttribute('role')).toBe('form');
75+
76+
await pageConditions.liveRegionStabilized();
77+
78+
// THEN: The live region shows what screen readers announce: "Bot said:", "A card: Hello, World!" (the "speak" property) for each card, then the input of the second card.
79+
await host.snapshot('local');
6980
});
7081
</script>
7182
</body>
19.5 KB
Loading

‎__tests__/html2/accessibility/adaptiveCard/hack.roleMod.unlabelled.html‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<html lang="en-US">
33
<head>
44
<link href="/assets/index.css" rel="stylesheet" type="text/css" />
5+
<!-- Shows the live region, so the snapshot shows the copy sent to screen readers. -->
6+
<link href="/assets/accessibility.liveRegionAttachment.css" rel="stylesheet" type="text/css" />
57
<script crossorigin="anonymous" src="/test-harness.js"></script>
68
<script crossorigin="anonymous" src="/test-page-object.js"></script>
79
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
@@ -21,8 +23,9 @@
2123
run(async function () {
2224
const { directLine, store } = testHelpers.createDirectLineEmulator();
2325

26+
// GIVEN: Web Chat keeps the live region copy of new messages, so it can be seen in the snapshot.
2427
WebChat.renderWebChat(
25-
{ directLine, store, styleOptions: { hideSendBox: true } },
28+
{ directLine, store, styleOptions: { hideSendBox: true, internalLiveRegionFadeAfter: 60000 } },
2629
document.getElementById('webchat')
2730
);
2831

@@ -78,6 +81,11 @@
7881
({ role }) => role?.value
7982
)
8083
).toEqual(['generic', 'generic']);
84+
85+
await pageConditions.liveRegionStabilized();
86+
87+
// THEN: The live region shows what screen readers announce: "Bot said:", "A card:" for each card, then the input and the "Submit" button of the second card.
88+
await host.snapshot('local');
8189
});
8290
</script>
8391
</body>
19.5 KB
Loading

0 commit comments

Comments
 (0)