Update Current Navigation to version 1.1.6 with new features and improvements, including reliable detection of active path using current SharePoint web URL.

This commit is contained in:
Torsten Brendgen
2026-08-23 22:14:52 +02:00
parent 26edaf6652
commit 6c67625eba
10 changed files with 48 additions and 12 deletions
+16 -1
View File
@@ -1,5 +1,5 @@
import {
buildCurrentNavigationItems, getLocalProperty, normalizeRootWebPath, parseBoolean, resolveTermUrl,
buildCurrentNavigationItems, getLocalProperty, isCurrentNavigationUrl, normalizeRootWebPath, parseBoolean, resolveTermUrl,
selectCurrentNavigationRoot
} from '../src/services/CurrentNavigationCore';
import { ICurrentNavigationTerm } from '../src/services/CurrentNavigationTypes';
@@ -41,6 +41,21 @@ const root: ICurrentNavigationTerm = selectCurrentNavigationRoot(
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');
assert('site URL is current while a modern home page is open', isCurrentNavigationUrl(
'http://dhs.contoso.local/organisation/cir/CIR_13/',
'http://dhs.contoso.local/organisation/cir/CIR_13/SitePages/Home.aspx',
'http://dhs.contoso.local/organisation/cir/CIR_13'
));
assert('configured site home URL matches another page in the same web', isCurrentNavigationUrl(
'http://dhs.contoso.local/organisation/cir/CIR_13/SitePages/Home.aspx',
'http://dhs.contoso.local/organisation/cir/CIR_13/SitePages/News.aspx',
'http://dhs.contoso.local/organisation/cir/CIR_13/'
));
assert('different web is not current', !isCurrentNavigationUrl(
'http://dhs.contoso.local/organisation/cir/CIR_3/',
'http://dhs.contoso.local/organisation/cir/CIR_13/SitePages/Home.aspx',
'http://dhs.contoso.local/organisation/cir/CIR_13/'
));
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');