[AAE-2537] - fix mark as read notification (#5667)

* [AAE-2537] - fix mark as read notification

* lint

* fix unit test

Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
Silviu Popa
2020-05-13 03:20:19 +03:00
committed by GitHub
parent 171089d1d6
commit f850d7ed38
2 changed files with 16 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import { CoreTestingModule } from '../../testing/core.testing.module';
import { NotificationHistoryComponent } from './notification-history.component';
import { OverlayContainer } from '@angular/cdk/overlay';
import { NotificationService } from '../services/notification.service';
import { StorageService } from '../../services/storage.service';
describe('Notification History Component', () => {
@@ -28,6 +29,7 @@ describe('Notification History Component', () => {
let element: HTMLElement;
let notificationService: NotificationService;
let overlayContainerElement: HTMLElement;
let storage: StorageService;
function openNotification() {
fixture.detectChanges();
@@ -44,6 +46,7 @@ describe('Notification History Component', () => {
fixture = TestBed.createComponent(NotificationHistoryComponent);
element = fixture.nativeElement;
storage = TestBed.get(StorageService);
notificationService = TestBed.get(NotificationService);
}));
@@ -76,5 +79,17 @@ describe('Notification History Component', () => {
done();
});
});
it('should remove notification from storage when mark all as read', (done) => {
openNotification();
fixture.whenStable().then(() => {
const markAllAsRead = <HTMLButtonElement> overlayContainerElement.querySelector('#adf-notification-history-mark-as-read button');
markAllAsRead.click();
fixture.detectChanges();
expect(storage.getItem('notifications')).toBeNull();
done();
});
});
});
});