Update Current Navigation to version 1.1.4 with new features and improvements

This commit is contained in:
Torsten Brendgen
2026-08-18 21:18:11 +02:00
parent 9b73bb4614
commit 61a968562d
9 changed files with 100 additions and 18 deletions
+40 -1
View File
@@ -1,5 +1,6 @@
import {
buildCurrentNavigationItems, getLocalProperty, parseBoolean, resolveTermUrl, selectCurrentNavigationRoot
buildCurrentNavigationItems, getLocalProperty, normalizeRootWebPath, parseBoolean, resolveTermUrl,
selectCurrentNavigationRoot
} from '../src/services/CurrentNavigationCore';
import { ICurrentNavigationTerm } from '../src/services/CurrentNavigationTypes';
@@ -33,6 +34,8 @@ const root: ICurrentNavigationTerm = selectCurrentNavigationRoot(
terms, 'https://portal/sites/portal/hr', 'https://portal/sites/portal'
);
assert('root is selected through its site home URL', !!root && root.Id === 'root');
assert('site home URL is normalized to its web',
normalizeRootWebPath('/sites/portal/hr/SitePages/Home.aspx') === '/sites/portal/hr');
const items = buildCurrentNavigationItems(terms, root, 'https://portal/sites/portal', 1031, 3, false);
assert('root is not rendered by default', items.length === 1 && items[0].id === 'docs');
assert('descendants are nested', items[0].items.length === 1 && items[0].items[0].id === 'forms');
@@ -44,4 +47,40 @@ const unordered = buildCurrentNavigationItems(
);
assert('hierarchy is independent of taxonomy response order',
unordered.length === 1 && unordered[0].id === 'docs' && unordered[0].items[0].id === 'forms');
const inheritedTerms: ICurrentNavigationTerm[] = [
term({ Id: 'kits', Name: 'KITS', PathOfTerm: 'Organisation;CIR;KITS', LocalCustomProperties: {
'CurrentNavigation.Root': 'true',
'_Sys_Nav_SimpleLinkUrl': 'http://dhs.contoso.local/organisation/cir/CIR_3/'
}}),
term({ Id: 'team', Name: 'Team SharePoint', PathOfTerm: 'Organisation;CIR;KITS;Team SharePoint',
LocalCustomProperties: {
'TopNavigation.Hidden': 'true',
'_Sys_Nav_SimpleLinkUrl': 'http://dhs.contoso.local/organisation/cir/CIR_13/'
}}),
term({ Id: 'games', Name: 'Spielewiese', PathOfTerm: 'Organisation;CIR;KITS;Team SharePoint;Spielewiese',
LocalCustomProperties: {
'_Sys_Nav_SimpleLinkUrl': 'http://dhs.contoso.local/organisation/cir/CIR_21/'
}})
];
const inheritedRoot: ICurrentNavigationTerm = selectCurrentNavigationRoot(
inheritedTerms,
'http://dhs.contoso.local/organisation/cir/CIR_21/',
'http://dhs.contoso.local/organisation/cir'
);
assert('nearest taxonomy ancestor root applies to a web with a generic URL',
!!inheritedRoot && inheritedRoot.Id === 'kits');
const teamRoot: ICurrentNavigationTerm = selectCurrentNavigationRoot(
inheritedTerms,
'http://dhs.contoso.local/organisation/cir/CIR_13/',
'http://dhs.contoso.local/organisation/cir'
);
assert('taxonomy ancestor root also applies to the direct child web',
!!teamRoot && teamRoot.Id === 'kits');
const inheritedItems = buildCurrentNavigationItems(
inheritedTerms, inheritedRoot, 'http://dhs.contoso.local/organisation/cir', 1031, 3, false
);
assert('top-navigation hidden does not hide current navigation terms',
inheritedItems.length === 1 && inheritedItems[0].id === 'team' &&
inheritedItems[0].items.length === 1 && inheritedItems[0].items[0].id === 'games');
console.log('CurrentNavigation core tests passed:', passed);
+4 -4
View File
@@ -9,8 +9,8 @@ var manifest = json('src/extensions/currentNavigation/CurrentNavigationApplicati
var app = read('src/extensions/currentNavigation/CurrentNavigationApplicationCustomizer.ts');
var renderer = read('src/extensions/currentNavigation/CurrentNavigationRenderer.ts');
var service = read('src/services/CurrentNavigationTaxonomyService.ts');
assert('package version', packageJson.version === '1.1.3');
assert('solution version', solution.version === '1.1.3.0');
assert('package version', packageJson.version === '1.1.4');
assert('solution version', solution.version === '1.1.4.0');
assert('tenant deployment', solution.skipFeatureDeployment === true);
assert('component type', manifest.extensionType === 'ApplicationCustomizer');
assert('safe renderer', renderer.indexOf('innerHTML') < 0 && app.indexOf('innerHTML') < 0);
@@ -20,8 +20,8 @@ assert('targets SharePoint ms-Nav fallback', app.indexOf('nav[role="navigation"]
app.indexOf("querySelector('.ms-Nav-navItems')") >= 0);
assert('native navigation is not hidden', app.indexOf('current-navigation-managed') < 0 &&
read('src/extensions/currentNavigation/CurrentNavigation.module.scss').indexOf(':not(#CurrentNavigationHost)') < 0);
assert('row hover and neutral border', read('src/extensions/currentNavigation/CurrentNavigation.module.scss').indexOf('.current-navigation-row:hover') >= 0 &&
read('src/extensions/currentNavigation/CurrentNavigation.module.scss').indexOf('default: #edebe9') >= 0);
assert('whole row hover',
read('src/extensions/currentNavigation/CurrentNavigation.module.scss').indexOf('.current-navigation-row:hover') >= 0);
assert('custom navigation is appended below SiteNavigation', app.indexOf('this.siteNavigation.appendChild(this.host)') >= 0);
assert('observer cleanup', app.indexOf('observer.disconnect()') >= 0);
assert('treeview semantics', renderer.indexOf("setAttribute('role', root ? 'tree' : 'group')") >= 0 &&