We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 174d185 + bb02acf commit 4a2158aCopy full SHA for 4a2158a
6 files changed
src/app/shared/menu/menu-provider.model.ts
@@ -23,6 +23,7 @@ import { MenuItemModels } from './menu-section.model';
23
*/
24
export interface PartialMenuSection {
25
id?: string;
26
+ accessibilityHandle?: string;
27
visible: boolean;
28
model: MenuItemModels;
29
parentID?: string;
src/app/shared/menu/menu-section.model.ts
@@ -19,6 +19,11 @@ export interface MenuSection {
19
20
id: string;
21
22
+ /**
+ * Accessibility handle that can be used to find a specific menu in the html
+ */
+
/**
* Whether this section should be visible.
src/app/shared/menu/menu.structure.ts
@@ -94,7 +94,11 @@ function addProviderToList(providers: Provider[], providerType: Type<AbstractMen
94
provider.index = provider.index ?? index;
95
if (hasValue(parentID)) {
96
provider.menuProviderId = provider.menuProviderId ?? `${parentID}_${index}`;
97
- provider.parentID = provider.parentID ?? parentID;
+ let providerParentID = provider.parentID;
98
+ if (hasValue(providerParentID)) {
99
+ providerParentID = `${providerParentID}_0`;
100
+ }
101
+ provider.parentID = providerParentID ?? parentID;
102
} else {
103
provider.menuProviderId = provider.menuProviderId ?? `${menuID}_${index}`;
104
}
src/app/shared/menu/providers/helper-providers/expandable-menu-provider.spec.ts
@@ -62,8 +62,8 @@ describe('AbstractExpandableMenuProvider', () => {
62
type: MenuItemType.TEXT,
63
text: 'sub.section.test.1',
64
},
65
- id: `${MenuID.ADMIN}_1_0`,
66
- parentID: `${MenuID.ADMIN}_1`,
+ id: `${MenuID.ADMIN}_1_0_0`,
+ parentID: `${MenuID.ADMIN}_1_0`,
67
alwaysRenderExpandable: false,
68
69
{
@@ -72,8 +72,8 @@ describe('AbstractExpandableMenuProvider', () => {
72
73
text: 'sub.section.test.2',
74
75
- id: `${MenuID.ADMIN}_1_1`,
76
+ id: `${MenuID.ADMIN}_1_0_1`,
77
78
79
@@ -83,7 +83,7 @@ describe('AbstractExpandableMenuProvider', () => {
83
text: 'top.section.test',
84
85
icon: 'file-import',
86
- id: `${MenuID.ADMIN}_1`,
+ id: `${MenuID.ADMIN}_1_0`,
87
alwaysRenderExpandable: true,
88
89
];
src/app/shared/menu/providers/helper-providers/expandable-menu-provider.ts
@@ -45,11 +45,12 @@ export abstract class AbstractExpandableMenuProvider extends AbstractMenuProvide
45
map((
46
[partialTopSection, partialSubSections]: [PartialMenuSection, PartialMenuSection[]],
47
) => {
48
+ const parentID = partialTopSection.id ?? this.getAutomatedSectionIdForTopSection();
49
const subSections = partialSubSections.map((partialSub, index) => {
50
return {
51
...partialSub,
- id: partialSub.id ?? `${this.menuProviderId}_${index}`,
52
- parentID: this.menuProviderId,
+ id: partialSub.id ?? this.getAutomatedSectionIdForSubsection(index),
53
+ parentID: parentID,
54
55
};
56
});
@@ -58,7 +59,7 @@ export abstract class AbstractExpandableMenuProvider extends AbstractMenuProvide
58
59
...subSections,
60
61
...partialTopSection,
- id: this.menuProviderId,
+ id: parentID,
alwaysRenderExpandable: this.alwaysRenderExpandable,
@@ -70,7 +71,7 @@ export abstract class AbstractExpandableMenuProvider extends AbstractMenuProvide
70
71
return this.getAutomatedSectionId(0);
protected getAutomatedSectionIdForSubsection(indexOfSubSectionInProvider: number): string {
- return `${this.menuProviderId}_0_${indexOfSubSectionInProvider}`;
+ return `${this.getAutomatedSectionIdForTopSection()}_${indexOfSubSectionInProvider}`;
src/app/shared/menu/providers/helper-providers/route-context.menu.spec.ts
@@ -22,7 +22,7 @@ import { MenuItemType } from '../../menu-item-type.model';
import { PartialMenuSection } from '../../menu-provider.model';
import { AbstractRouteContextMenuProvider } from './route-context.menu';
-describe('AbstractExpandableMenuProvider', () => {
+describe('AbstractRouteContextMenuProvider', () => {
class TestClass extends AbstractRouteContextMenuProvider<CacheableObject> {
getRouteContext(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<CacheableObject> {
0 commit comments