mirror of
https://github.com/discourse/discourse.git
synced 2025-05-17 15:13:09 +08:00
A11Y: Improve "my posts" sidebar link title (#19132)
This commit is contained in:
parent
91701d677f
commit
69e55a0e1c
@ -47,8 +47,12 @@ export default class MyPostsSectionLink extends BaseSectionLink {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get 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");
|
return I18n.t("sidebar.sections.community.links.my_posts.title");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get text() {
|
get text() {
|
||||||
return I18n.t("sidebar.sections.community.links.my_posts.content");
|
return I18n.t("sidebar.sections.community.links.my_posts.content");
|
||||||
|
@ -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) {
|
test("visiting top route", async function (assert) {
|
||||||
await visit("/top");
|
await visit("/top");
|
||||||
|
|
||||||
|
@ -4248,7 +4248,8 @@ en:
|
|||||||
title: "All users"
|
title: "All users"
|
||||||
my_posts:
|
my_posts:
|
||||||
content: "My Posts"
|
content: "My Posts"
|
||||||
title: "My posts"
|
title: "My recent topic activity"
|
||||||
|
title_drafts: "My unposted drafts"
|
||||||
draft_count:
|
draft_count:
|
||||||
one: "%{count} draft"
|
one: "%{count} draft"
|
||||||
other: "%{count} drafts"
|
other: "%{count} drafts"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user