The request is understood Check the database Check the database2
`, nameEvents: ['doCheckDatabase', 'doCheckDatabaseTwo'] }]; } generateSimpleNotifications(): StNotificationElement[] { return [ { text: `The request is understood` }]; } generateMultiLineNotification(): StNotificationElement[] { return [{ text: `Stratio audit failed to connect to Postgres database / second page.The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits . Other reasons for this status being returned are listed alongside the error codes in the table below.The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits .`, status: 'success' }, { text: `Stratio audit failed to connect to Postgres database / second page.The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits . Other reasons for this status being returned are listed alongside the error codes in the table below.The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits .`, status: 'running' }]; } generatePaginationNotification(): StNotificationElement[] { return [{ text: `notification one`, status: 'success' }, { text: `notification two`, status: 'running' }]; } } let comp: TestStFNComponent; let fixture: ComponentFixtureThe request is understood Check the database Check the database2
', bypassSecurityTrustHtml: () => 'safeString' } } ] }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(TestStFNComponent); comp = fixture.componentInstance; comp.notifications = comp.generateSimpleNotifications(); nativeElement = fixture.nativeElement; }); describe('When visible is true ', () => { it('And status is defined as default, The element should contain "default" class', async(() => { comp.visible = true; comp.notifications[0].status = 'default'; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); expect(nativeElement.querySelector('.foreground-notification').classList).toContain('default'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('warning'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('success'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('critical'); })); it('And status is defined as sucess, element should contain "success" class', async(() => { comp.visible = true; comp.notifications[0].status = 'success'; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); expect(nativeElement.querySelector('.foreground-notification').classList).toContain('success'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('warning'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('default'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('critical'); })); it('And status is defined as warning, element should contain "warning" class', async(() => { comp.visible = true; comp.notifications[0].status = 'warning'; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); expect(nativeElement.querySelector('.foreground-notification').classList).toContain('warning'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('default'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('success'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('critical'); })); it('And status is defined as critical, element should contain "critical" class', async(() => { comp.visible = true; comp.notifications[0].status = 'critical'; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); expect(nativeElement.querySelector('.foreground-notification').classList).toContain('critical'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('warning'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('success'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('default'); })); it('And status is not defined, element should contain "default" class', async(() => { comp.visible = true; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); expect(nativeElement.querySelector('.foreground-notification').classList).toContain('default'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('warning'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('success'); expect(nativeElement.querySelector('.foreground-notification').classList).not.toContain('critical'); })); it('And user click on the close icon, the element should fade out and then hidden', fakeAsync(() => { fixture.detectChanges(); let closeButton: HTMLElement = fixture.debugElement.query(By.css('.close')).nativeElement; comp.notifications[0].status = 'success'; comp.visible = true; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); closeButton.click(); fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).not.toContain('visible'); })); it(`when the property autoCloseTime is set and only have one notification with status success, the element should fade out and then hidden in the time set`, fakeAsync(() => { comp.autoCloseTime = 1000; comp.visible = true; comp.notifications[0].status = 'success'; fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).toContain('visible'); tick(2000); fixture.detectChanges(); expect(nativeElement.querySelector('st-foreground-notifications').classList).not.toContain('visible'); })); it(`a notification defined with html must be able to control the a href links`, async(() => { comp.notifications = comp.generateHtmlNotifications(); fixture.detectChanges(); spyOn(comp.clickLinkTemplate, 'emit'); comp.visible = true; comp.notifications[0].status = 'success'; fixture.detectChanges(); let hrefLink: HTMLElement =