FIX: Secondary more section links not marked as active (#17797)

When the route of the link is equal to the active route, we promote it
out of the "more..." links drawer and display it directly under the
community section. This commit fixes a bug where the secondary links in
the "more..." links drawer was not being marked as active.

Follow-up to e09fd7cde2
This commit is contained in:
Alan Guo Xiang Tan 2022-08-04 18:51:32 +08:00 committed by GitHub
parent 3eaac56797
commit ad18f7488c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -11,6 +11,8 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
@tracked activeSectionLink;
@service router;
#allLinks = [...this.args.sectionLinks, ...this.args.secondarySectionLinks];
constructor() {
super(...arguments);
this.#setActiveSectionLink();
@ -89,7 +91,7 @@ export default class SidebarMoreSectionLinks extends GlimmerComponent {
}
#setActiveSectionLink() {
const activeSectionLink = this.args.sectionLinks.find((sectionLink) => {
const activeSectionLink = this.#allLinks.find((sectionLink) => {
const args = [sectionLink.route];
if (sectionLink.model) {

View File

@ -313,6 +313,11 @@ acceptance("Sidebar - Community Section", function (needs) {
"/about",
"navigates to about route correctly"
);
assert.ok(
exists(".sidebar-section-community .sidebar-section-link-about.active"),
"about section link link is displayed in the main section and marked as active"
);
});
test("navigating to FAQ from sidebar", async function (assert) {