PluginPages: Support plugin pages that don't belong to a section (#55904)

* Fixing pages that don't exist in navtree

* Fix test

* fix lint warning

* Fixes
This commit is contained in:
Torkel Ödegaard
2022-09-29 13:27:51 +02:00
committed by GitHub
parent 34f18aacd6
commit b4f73c9f09
7 changed files with 44 additions and 45 deletions

View File

@ -86,12 +86,12 @@ describe('buildPluginSectionNav', () => {
expect(result?.node.text).toBe('Standalone page');
});
it('Should throw error if app not found in navtree', () => {
it('Should not throw error just return a root nav model without children for plugins that dont exist in navtree', () => {
config.featureToggles.topnav = true;
const action = () => {
buildPluginSectionNav({} as HistoryLocation, pluginNav, navIndex, 'app3');
};
expect(action).toThrowError();
const result = buildPluginSectionNav({} as HistoryLocation, pluginNav, navIndex, 'app3');
expect(result?.main.id).toBe('root-plugin-page');
expect(result?.main.hideFromBreadcrumbs).toBe(true);
expect(result?.main.children?.length).toBe(0);
});
it('Should throw error if app has no section', () => {