TopNav: Fixes to page and plugin page handling (#56278)

* Added labels

* App page fixes

* Switch to switch

* Fixing sort position for Apps
This commit is contained in:
Torkel Ödegaard
2022-10-05 11:46:27 +02:00
committed by GitHub
parent 4469572b27
commit aa274500cf
8 changed files with 119 additions and 67 deletions

View File

@@ -10,6 +10,7 @@ describe('buildPluginSectionNav', () => {
const app1: NavModelItem = {
text: 'App1',
id: 'plugin-page-app1',
url: '/a/plugin1',
children: [
{
text: 'page1',
@@ -74,6 +75,18 @@ describe('buildPluginSectionNav', () => {
expect(result?.node.text).toBe('page2');
});
it('Should set app section to active', () => {
config.featureToggles.topnav = true;
const result = buildPluginSectionNav(
{ pathname: '/a/plugin1', search: '' } as HistoryLocation,
null,
navIndex,
'app1'
);
expect(result?.main.children![0].active).toBe(true);
expect(result?.node.text).toBe('App1');
});
it('Should handle standalone page', () => {
config.featureToggles.topnav = true;
const result = buildPluginSectionNav(