|
|
|
@ -34,7 +34,7 @@ describe('ConfirmationService', () => { |
|
|
|
}); |
|
|
|
|
|
|
|
test('should display a confirmation popup', fakeAsync(() => { |
|
|
|
service.show('MESSAGE', 'TITLE'); |
|
|
|
service.show('_::MESSAGE', '_::TITLE'); |
|
|
|
|
|
|
|
tick(); |
|
|
|
|
|
|
|
@ -44,12 +44,12 @@ describe('ConfirmationService', () => { |
|
|
|
|
|
|
|
test('should display HTML string in title, message, and buttons', fakeAsync(() => { |
|
|
|
service.show( |
|
|
|
'<span class="custom-message">MESSAGE<span>', |
|
|
|
'<span class="custom-title">TITLE<span>', |
|
|
|
'_::<span class="custom-message">MESSAGE<span>', |
|
|
|
'_::<span class="custom-title">TITLE<span>', |
|
|
|
'neutral', |
|
|
|
{ |
|
|
|
cancelText: '<span class="custom-cancel">CANCEL</span>', |
|
|
|
yesText: '<span class="custom-yes">YES</span>', |
|
|
|
cancelText: '_::<span class="custom-cancel">CANCEL</span>', |
|
|
|
yesText: '_::<span class="custom-yes">YES</span>', |
|
|
|
}, |
|
|
|
); |
|
|
|
|
|
|
|
@ -62,7 +62,7 @@ describe('ConfirmationService', () => { |
|
|
|
})); |
|
|
|
|
|
|
|
test('should display custom FA icon', fakeAsync(() => { |
|
|
|
service.show('MESSAGE', 'TITLE', undefined, { |
|
|
|
service.show('_::MESSAGE', '_::TITLE', undefined, { |
|
|
|
icon: 'fa fa-info', |
|
|
|
}); |
|
|
|
|
|
|
|
@ -74,7 +74,7 @@ describe('ConfirmationService', () => { |
|
|
|
const className = 'custom-icon'; |
|
|
|
const selector = '.' + className; |
|
|
|
|
|
|
|
service.show('MESSAGE', 'TITLE', undefined, { |
|
|
|
service.show('_::MESSAGE', '_::TITLE', undefined, { |
|
|
|
iconTemplate: `<span class="${className}">I am icon</span>`, |
|
|
|
}); |
|
|
|
|
|
|
|
@ -91,7 +91,7 @@ describe('ConfirmationService', () => { |
|
|
|
${'warn'} | ${'.warning'} | ${'.fa-exclamation-triangle'} |
|
|
|
${'error'} | ${'.error'} | ${'.fa-times-circle'} |
|
|
|
`('should display $type confirmation popup', async ({ type, selector, icon }) => {
|
|
|
|
service[type]('MESSAGE', 'TITLE'); |
|
|
|
service[type]('_::MESSAGE', '_::TITLE'); |
|
|
|
|
|
|
|
await timer(0).toPromise(); |
|
|
|
|
|
|
|
@ -115,7 +115,7 @@ describe('ConfirmationService', () => { |
|
|
|
// });
|
|
|
|
|
|
|
|
test('should close when click cancel button', done => { |
|
|
|
service.info('', '', { yesText: 'Sure', cancelText: 'Exit' }).subscribe(status => { |
|
|
|
service.info('_::', '_::', { yesText: '_::Sure', cancelText: '_::Exit' }).subscribe(status => { |
|
|
|
expect(status).toBe(Confirmation.Status.reject); |
|
|
|
done(); |
|
|
|
}); |
|
|
|
@ -137,7 +137,7 @@ describe('ConfirmationService', () => { |
|
|
|
({ dismissible, count }) => { |
|
|
|
const spy = jest.spyOn(service as any, 'listenToEscape'); |
|
|
|
|
|
|
|
service.info('', '', { dismissible }); |
|
|
|
service.info('_::', '_::', { dismissible }); |
|
|
|
|
|
|
|
expect(spy).toHaveBeenCalledTimes(count); |
|
|
|
}, |
|
|
|
|