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:
@@ -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');
|
||||
|
||||
@@ -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.5');
|
||||
assert('solution version', solution.version === '1.1.5.0');
|
||||
assert('package version', packageJson.version === '1.1.6');
|
||||
assert('solution version', solution.version === '1.1.6.0');
|
||||
assert('tenant deployment', solution.skipFeatureDeployment === true);
|
||||
assert('component type', manifest.extensionType === 'ApplicationCustomizer');
|
||||
assert('safe renderer', renderer.indexOf('innerHTML') < 0 && app.indexOf('innerHTML') < 0);
|
||||
@@ -28,6 +28,9 @@ assert('treeview semantics', renderer.indexOf("setAttribute('role', root ? 'tree
|
||||
renderer.indexOf("setAttribute('role', 'treeitem')") >= 0);
|
||||
assert('configurable initial expansion', renderer.indexOf('isInitiallyExpanded(this.initialExpansion') >= 0 &&
|
||||
renderer.indexOf("initialExpansion === 'expanded'") >= 0 && app.indexOf('this.initialExpansion()') >= 0);
|
||||
assert('active path receives the current SharePoint web URL',
|
||||
app.indexOf('this.context.pageContext.web.absoluteUrl') >= 0 &&
|
||||
renderer.indexOf('isCurrentNavigationUrl(url, window.location.href, this.currentWebUrl)') >= 0);
|
||||
assert('legacy selector compatibility', renderer.indexOf(':scope') < 0);
|
||||
assert('local properties loaded', service.indexOf('LocalCustomProperties') >= 0);
|
||||
assert('root property present', read('src/services/CurrentNavigationCore.ts').indexOf('CurrentNavigation.Root') >= 0);
|
||||
|
||||
Reference in New Issue
Block a user