A11Y: improved titles for chat in the sidebar (#19134)
This commit is contained in:
@@ -112,6 +112,7 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
||||
{
|
||||
id: 3,
|
||||
title: "random",
|
||||
description: "The channel for random <script>evil</script> things",
|
||||
chatable_type: "Category",
|
||||
chatable: { slug: "random" },
|
||||
last_message_sent_at: "2021-11-08T21:26:05.710Z",
|
||||
@@ -421,6 +422,19 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
||||
assert.strictEqual(currentURL(), "/");
|
||||
});
|
||||
|
||||
test("Escaped channel description used as title when present", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
const randomChannel = queryAll(
|
||||
".sidebar-section-chat-channels .sidebar-section-link-wrapper .sidebar-section-link"
|
||||
)[3];
|
||||
|
||||
assert.strictEqual(
|
||||
randomChannel.title,
|
||||
"The channel for random <script>evil</script> things"
|
||||
);
|
||||
});
|
||||
|
||||
test("Escapes public channel titles", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
@@ -428,7 +442,10 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
||||
".sidebar-section-chat-channels .sidebar-section-link-wrapper .sidebar-section-link"
|
||||
);
|
||||
|
||||
assert.strictEqual(evilChannel.title, "<script>evil</script>");
|
||||
assert.strictEqual(
|
||||
evilChannel.title,
|
||||
"<script>evil</script> chat"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
evilChannel.className.includes(
|
||||
@@ -451,7 +468,10 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
|
||||
".sidebar-section-chat-dms .sidebar-section-link-wrapper .sidebar-section-link"
|
||||
)[3];
|
||||
|
||||
assert.strictEqual(evilChannel.title, "@<script>sam</script>");
|
||||
assert.strictEqual(
|
||||
evilChannel.title,
|
||||
"Chat with @<script>sam</script>"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
evilChannel.className.includes(
|
||||
|
||||
Reference in New Issue
Block a user