diff --git a/src/app/components/dynamicdialog/dynamicdialog.spec.ts b/src/app/components/dynamicdialog/dynamicdialog.spec.ts index 3d96af97f8b..878f0643c24 100755 --- a/src/app/components/dynamicdialog/dynamicdialog.spec.ts +++ b/src/app/components/dynamicdialog/dynamicdialog.spec.ts @@ -57,7 +57,7 @@ export class TestDynamicDialogWithClosableFalseComponent { }) export class FakeTestDialogModule {} -fdescribe('DynamicDialog', () => { +describe('DynamicDialog', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [NoopAnimationsModule, FakeTestDialogModule], diff --git a/src/app/components/message/message.spec.ts b/src/app/components/message/message.spec.ts index d2108fcb4eb..4d6a35fe3b4 100755 --- a/src/app/components/message/message.spec.ts +++ b/src/app/components/message/message.spec.ts @@ -46,19 +46,19 @@ describe('UIMessage', () => { expect(iconEl.nativeElement.parentElement.tagName.toLowerCase()).toEqual('infocircleicon'); }); - it('should change severity to error', () => { - message.severity = 'error'; + it('should change severity to danger', () => { + message.severity = 'danger'; fixture.detectChanges(); const messageEl = fixture.debugElement.query(By.css('div')); const iconEl = fixture.debugElement.query(By.css('.p-inline-message-icon')); expect(messageEl.nativeElement).toBeTruthy(); - expect(messageEl.nativeElement.className).toContain('p-inline-message-error'); + expect(messageEl.nativeElement.className).toContain('p-inline-message-danger'); expect(iconEl.nativeElement.parentElement.tagName.toLowerCase()).toEqual('timescircleicon'); }); it('should change severity to warning', () => { - message.severity = 'warn'; + message.severity = 'warning'; fixture.detectChanges(); const messageEl = fixture.debugElement.query(By.css('div')); @@ -67,8 +67,9 @@ describe('UIMessage', () => { expect(messageEl.nativeElement.className).toContain('p-inline-message-warn'); expect(iconEl.nativeElement.parentElement.tagName.toLowerCase()).toEqual('exclamationtriangleicon'); }); + it('should change severity to default', () => { - message.severity = ' '; + message.severity = 'primary'; fixture.detectChanges(); const messageEl = fixture.debugElement.query(By.css('div')); diff --git a/src/app/components/messages/messages.spec.ts b/src/app/components/messages/messages.spec.ts index ef64dfd0af9..b0b06c58499 100755 --- a/src/app/components/messages/messages.spec.ts +++ b/src/app/components/messages/messages.spec.ts @@ -26,6 +26,7 @@ import { TimesIcon } from 'primeng/icons/times'; + ` }) class TestMessagesComponent { @@ -69,6 +70,11 @@ class TestMessagesComponent { ]); } + showClosableFalse() { + this.msgs = []; + this.msgs.push({ summary: 'Not Closable Message', detail: 'Not closable', closable: false }); + } + clearWithService() { this.messageService.clear(); } @@ -243,4 +249,18 @@ describe('Messages', () => { const messageEl = fixture.debugElement.queryAll(By.css('.p-message-icon')); expect(messageEl.length).toEqual(2); }); + + it('should disable closable messages', () => { + fixture.detectChanges(); + + const closableButton = fixture.debugElement.queryAll(By.css('button'))[9]; + closableButton.nativeElement.click(); + fixture.detectChanges(); + + const detailEl = fixture.debugElement.query(By.css('.p-message-detail')); + const clearButton = fixture.debugElement.query(By.css('.p-message-close')); + + expect(clearButton).toBeFalsy(); + expect(detailEl.nativeElement.innerHTML).toContain('Not closable'); + }); });