Navigation: Fix finding the active nav item for plugins (#62123)

fix: look for the active page under children first
This commit is contained in:
Levente Balogh
2023-01-26 15:10:09 +01:00
committed by GitHub
parent 75ffbe422b
commit 995e2715ad
2 changed files with 15 additions and 1 deletions

View File

@@ -69,6 +69,13 @@ describe('buildPluginSectionNav', () => {
expect(result?.node.text).toBe('page2');
});
it('Should only set the most specific match as active (not the parents)', () => {
config.featureToggles.topnav = true;
const result = buildPluginSectionNav(appsSection, null, '/a/plugin1/page2');
expect(result?.main.children![0].children![1].active).toBe(true);
expect(result?.main.children![0].active).not.toBe(true); // Parent should not be active
});
it('Should set app section to active', () => {
config.featureToggles.topnav = true;
const result = buildPluginSectionNav(appsSection, null, '/a/plugin1');