A11Y: Improve "my posts" sidebar link title (#19132)
This commit is contained in:
parent
91701d677f
commit
69e55a0e1c
|
@ -47,7 +47,11 @@ export default class MyPostsSectionLink extends BaseSectionLink {
|
|||
}
|
||||
|
||||
get title() {
|
||||
return I18n.t("sidebar.sections.community.links.my_posts.title");
|
||||
if (this._hasDraft) {
|
||||
return I18n.t("sidebar.sections.community.links.my_posts.title_drafts");
|
||||
} else {
|
||||
return I18n.t("sidebar.sections.community.links.my_posts.title");
|
||||
}
|
||||
}
|
||||
|
||||
get text() {
|
||||
|
|
|
@ -564,6 +564,26 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
|
|||
);
|
||||
});
|
||||
|
||||
test("my posts title changes when drafts are present", async function (assert) {
|
||||
await visit("/");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".sidebar-section-link-my-posts").title,
|
||||
I18n.t("sidebar.sections.community.links.my_posts.title"),
|
||||
"displays the default title when no drafts are present"
|
||||
);
|
||||
|
||||
await publishToMessageBus(`/user-drafts/${loggedInUser().id}`, {
|
||||
draft_count: 1,
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
query(".sidebar-section-link-my-posts").title,
|
||||
I18n.t("sidebar.sections.community.links.my_posts.title_drafts"),
|
||||
"displays the draft title when drafts are present"
|
||||
);
|
||||
});
|
||||
|
||||
test("visiting top route", async function (assert) {
|
||||
await visit("/top");
|
||||
|
||||
|
|
|
@ -4248,7 +4248,8 @@ en:
|
|||
title: "All users"
|
||||
my_posts:
|
||||
content: "My Posts"
|
||||
title: "My posts"
|
||||
title: "My recent topic activity"
|
||||
title_drafts: "My unposted drafts"
|
||||
draft_count:
|
||||
one: "%{count} draft"
|
||||
other: "%{count} drafts"
|
||||
|
|
Loading…
Reference in New Issue