diff --git a/lib/core/src/lib/notifications/components/notification-history.component.html b/lib/core/src/lib/notifications/components/notification-history.component.html index bd57157bc38..aaff992988b 100644 --- a/lib/core/src/lib/notifications/components/notification-history.component.html +++ b/lib/core/src/lib/notifications/components/notification-history.component.html @@ -7,7 +7,7 @@ id="adf-notification-history-open-button" (menuOpened)="onMenuOpened()"> notifications diff --git a/lib/core/src/lib/notifications/components/notification-history.component.spec.ts b/lib/core/src/lib/notifications/components/notification-history.component.spec.ts index 7ce24e332a8..19758543bf7 100644 --- a/lib/core/src/lib/notifications/components/notification-history.component.spec.ts +++ b/lib/core/src/lib/notifications/components/notification-history.component.spec.ts @@ -23,7 +23,6 @@ import { NotificationService } from '../services/notification.service'; import { StorageService } from '../../common/services/storage.service'; import { TranslateModule } from '@ngx-translate/core'; import { NotificationModel, NOTIFICATION_TYPE, NOTIFICATION_STORAGE } from '../models/notification.model'; -import { By } from '@angular/platform-browser'; describe('Notification History Component', () => { @@ -42,8 +41,6 @@ describe('Notification History Component', () => { fixture.detectChanges(); }; - const getMatBadgeElement = (): HTMLElement => fixture.debugElement.query(By.css('[matBadge]')).nativeElement; - beforeEach(() => { TestBed.configureTestingModule({ imports: [ @@ -231,29 +228,4 @@ describe('Notification History Component', () => { expect(component.unreadNotifications.length).toEqual(1); expect(component.unreadNotifications[0].read).toEqual(false); }); - - it('should return isBadgeVisible as true when there are unread notifications', () => { - component.unreadNotifications = testNotifications; - - const result = component.isBadgeVisible(); - const matIconDebugElement = getMatBadgeElement(); - - expect(result).toBe(true); - expect(matIconDebugElement.textContent).toContain('notifications'); - }); - - it('should return isBadgeVisible as false when there are no unread notifications', () => { - testNotifications.forEach((notification: NotificationModel) => { - notification.read = true; - }); - component.notifications = testNotifications; - fixture.detectChanges(); - - const result = component.isBadgeVisible(); - const matBadgeDebugElement = getMatBadgeElement(); - - expect(component.unreadNotifications).toEqual([]); - expect(result).toBe(false); - expect(matBadgeDebugElement.textContent).toContain(''); - }); }); diff --git a/lib/core/src/lib/notifications/components/notification-history.component.ts b/lib/core/src/lib/notifications/components/notification-history.component.ts index 4e95d6e8929..8eea1db056d 100644 --- a/lib/core/src/lib/notifications/components/notification-history.component.ts +++ b/lib/core/src/lib/notifications/components/notification-history.component.ts @@ -54,7 +54,6 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie paginatedNotifications: NotificationModel[] = []; unreadNotifications: NotificationModel[] = []; pagination: PaginationModel; - badgeHidden: boolean; constructor(private notificationService: NotificationService, public storageService: StorageService, public cd: ChangeDetectorRef) {} @@ -64,7 +63,6 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie JSON.parse(this.storageService.getItem(NOTIFICATION_STORAGE))?.filter( (notification: NotificationModel) => !notification.read ) || []; - this.badgeHidden = !this.isBadgeVisible(); } ngAfterViewInit(): void { @@ -82,7 +80,6 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie } addNewNotification(notification: NotificationModel) { - this.badgeHidden = !this.isBadgeVisible(); this.unreadNotifications.unshift(notification); if (this.unreadNotifications.length > NotificationHistoryComponent.MAX_NOTIFICATION_STACK_LENGTH) { @@ -99,7 +96,6 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie }); this.storageService.setItem(NOTIFICATION_STORAGE, JSON.stringify(this.notifications)); - this.badgeHidden = !this.isBadgeVisible(); } onMenuOpened() { @@ -122,7 +118,6 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie notification.read = true; }); - this.badgeHidden = !this.isBadgeVisible(); this.storageService.setItem(NOTIFICATION_STORAGE, JSON.stringify(this.notifications)); this.paginatedNotifications = []; this.createPagination(); @@ -155,8 +150,4 @@ export class NotificationHistoryComponent implements OnDestroy, OnInit, AfterVie this.trigger.closeMenu(); } } - - isBadgeVisible(): boolean { - return this.unreadNotifications.length > 0; - } }