Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
style: TT-191 styling sidebar code
  • Loading branch information
thegreatyamori committed Apr 13, 2021
commit cc93ed0eab8fbfcf801f6d402e09de5b11e8b494
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,12 @@ describe('SidebarComponent', () => {
const route = 'time-clock';
router.navigate([route]);

component.itemsSidebar
.filter((item) => item.route === `/${route}`)
.map((item) => {
expect(item.active).toBeTrue();
});
component.itemsSidebar
.filter((item) => item.route !== `/${route}`)
.map((item) => {
expect(item.active).toBeFalse();
});
component.itemsSidebar.filter((item) => item.route === `/${route}`).map((item) => {
expect(item.active).toBeTrue();
});
component.itemsSidebar.filter((item) => item.route !== `/${route}`).map((item) => {
expect(item.active).toBeFalse();
});
});

it('List Technologies item is added when feature flag "ui-list-technologies" is enabled for user', () => {
Expand Down
30 changes: 16 additions & 14 deletions src/app/modules/shared/components/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export class SidebarComponent implements OnInit, OnDestroy {
private featureManagerService: FeatureManagerService,
private featureSwitchGroup: FeatureSwitchGroupService
) {
this.navStart = this.router.events.pipe(filter((evt) => evt instanceof NavigationStart)) as Observable<
NavigationStart
>;
this.navStart = this.router.events.pipe(
filter((evt) => evt instanceof NavigationStart)
) as Observable<NavigationStart>;
}

ngOnInit(): void {
Expand Down Expand Up @@ -78,17 +78,19 @@ export class SidebarComponent implements OnInit, OnDestroy {
}

toggleListTechnologies(itemsSidebar: ItemSidebar[]) {
this.featureManagerService.isToggleEnabledForUser('ui-list-technologies').subscribe((enabled) => {
if (enabled === true) {
const listTechnologiesItem = {
route: '/technology-report',
icon: 'fas fa-user',
text: 'Technology Report',
active: false,
};
itemsSidebar.push(listTechnologiesItem);
}
});
this.featureManagerService
.isToggleEnabledForUser('ui-list-technologies')
.subscribe((enabled) => {
if (enabled === true) {
const listTechnologiesItem = {
route: '/technology-report',
icon: 'fas fa-user',
text: 'Technology Report',
active: false,
};
itemsSidebar.push(listTechnologiesItem);
}
});
}

highlightMenuOption(route) {
Expand Down