Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump deps and remove remark and strip-markdown #3917

Merged
merged 37 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
253627f
Bump deps
compulim May 27, 2021
8098c36
Go back to v1
compulim May 27, 2021
c81250a
Remove remark and strip-markdown
compulim May 27, 2021
2b7332d
Revert to v1
compulim May 27, 2021
02d1878
Revert to v1
compulim May 27, 2021
b76f630
Revert to v1
compulim May 27, 2021
3de4f40
Supports summary field
compulim May 27, 2021
e6e8656
Ignore summary field
compulim May 27, 2021
3848258
Strip Markdown from HTML
compulim May 28, 2021
6844630
Add speak field not present
compulim May 28, 2021
e24b0eb
Update strip Markdown
compulim May 28, 2021
7070d0b
Narrate empty text field
compulim May 28, 2021
8326dd0
Use different text computation for HTML/Markdown
compulim May 28, 2021
2bdea47
Clean up
compulim May 28, 2021
b5c8e2e
Update with samples
compulim May 28, 2021
ea061d1
More inline elements
compulim May 28, 2021
01ecd81
Clean up
compulim May 28, 2021
6bf131d
MessageBack must not be Markdown
compulim May 28, 2021
e136c8f
Lockdown performance
compulim May 28, 2021
884c0bc
Add snapshots
compulim May 28, 2021
e4c9ef1
Fix MessageBack
compulim May 28, 2021
8f9ba7f
Remove renderMarkdownAsHTML
compulim May 28, 2021
6b6a974
Fix ESLint
compulim May 28, 2021
36afb79
Assume plain text if renderMarkdown is null
compulim May 28, 2021
1000321
Compute text alternatives using alt field
compulim Jun 1, 2021
ab7242b
Change to webchat:fallback-text field
compulim Jun 2, 2021
cf2c82f
Bump to [email protected]
compulim Jun 2, 2021
70375f5
Typo
compulim Jun 2, 2021
4bc5c60
Update entry
compulim Jun 2, 2021
246eb64
Typo
compulim Jun 2, 2021
510348f
Update entry
compulim Jun 2, 2021
80d6a27
Link to issue
compulim Jun 2, 2021
86fc365
Undo package*.json for core/embed
compulim Jun 2, 2021
c85d9dd
Move allTextContents into testHelpers
compulim Jun 3, 2021
9d862ef
Add @param
compulim Jun 3, 2021
8ee4888
Apply PR suggestions
compulim Jun 3, 2021
f9060f2
Update text
compulim Jun 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions __tests__/html/accessibility.liveRegionActivity.text.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<!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>
<script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script>
</head>
<body>
<div id="webchat"></div>
<script>
function allTextContents(element) {
compulim marked this conversation as resolved.
Show resolved Hide resolved
const nodes = [].slice.call(element.childNodes);
const results = [];

while (nodes.length) {
const node = nodes.shift();

if (node.nodeType === Node.TEXT_NODE) {
results.push(node.textContent);
} else {
nodes.unshift(...[].slice.call(node.childNodes));
}
}

return results;
}

run(async function () {
const timestamp = new Date(2000, 0, 1, 12, 34, 56, 789).toISOString();

WebChat.renderWebChat(
{
directLine: testHelpers.createDirectLineWithTranscript([
{
from: {
id: 'bot',
role: 'bot'
},
text: 'Hello, **World** without `speak` property.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
from: {
id: 'bot',
role: 'bot'
},
speak: {},
text: 'Hello, **World** with invalid `speak` property.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
from: {
id: 'bot',
role: 'bot'
},
speak: 'Hello, World with speak property in plain text.',
text: 'Hello, **World** with `speak` property in plain text.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
from: {
id: 'bot',
role: 'bot'
},
speak: `<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="string">
Hello, World with simple speak property in SSML.
</speak>`,
text: 'Hello, **World** with simple `speak` property in SSML.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
from: {
id: 'bot',
role: 'bot'
},
speak: `<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="string">
<p>
<s>Hello, <prosody pitch="high">World</prosody> with <say-as interpret-as="spell-out">complex</say-as> speak property in SSML.</s>
</p>
</speak>`,
text: 'Hello, **World** with complex `speak` property in SSML.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
from: {
id: 'bot',
role: 'bot'
},
speak: 'Say another thing.',
text: 'Display one thing.',
textFormat: 'markdown',
timestamp,
type: 'message'
},
{
channelData: {
messageBack: {
displayText: 'Text from MessageBack.'
}
},
from: { id: 'user', role: 'user' },
text: 'This should not be displayed.',
timestamp,
type: 'message'
}
]),
store: testHelpers.createStore(),
styleOptions: {
internalLiveRegionFadeAfter: 60000
}
},
document.getElementById('webchat')
);

await pageConditions.uiConnected();

const liveRegion = document.querySelector('[aria-roledescription="transcript"][role="log"]');
const screenReaderTexts = [].map.call(liveRegion.children, child => allTextContents(child).join(' '));

expect(screenReaderTexts).toHaveLength(7);

// Without "speak" property set, we will be narrating the "text" as-is.
expect(screenReaderTexts[0]).toBe(
'Bot said: Hello, **World** without `speak` property. Sent at January 1 at 12:34 PM'
);

// Without "speak" property set, we will be narrating the "text" as-is.
compulim marked this conversation as resolved.
Show resolved Hide resolved
expect(screenReaderTexts[1]).toBe(
'Bot said: Hello, **World** with invalid `speak` property. Sent at January 1 at 12:34 PM'
);

expect(screenReaderTexts[2]).toBe(
'Bot said: Hello, World with speak property in plain text. Sent at January 1 at 12:34 PM'
);

expect(screenReaderTexts[3]).toBe(
'Bot said: Hello, World with simple speak property in SSML. Sent at January 1 at 12:34 PM'
);

expect(screenReaderTexts[4]).toBe(
'Bot said: Hello, World with complex speak property in SSML. Sent at January 1 at 12:34 PM'
);

expect(screenReaderTexts[5]).toBe('Bot said: Say another thing. Sent at January 1 at 12:34 PM');
expect(screenReaderTexts[6]).toBe('You said: Text from MessageBack. Sent at January 1 at 12:34 PM');

// The screenshot should show the message in Markdown format, i.e. <strong> and <code>.
// It must not show the text "This should not be displayed."
await host.snapshot();
});
</script>
</body>
</html>
6 changes: 6 additions & 0 deletions __tests__/html/accessibility.liveRegionActivity.text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @jest-environment ./packages/test/harness/src/host/jest/WebDriverEnvironment.js */

describe('accessibility requirement', () => {
test('should clean up "speak" property for live region text', () =>
runHTML('accessibility.liveRegionActivity.text.html'));
});
Loading