|
|
@ -6,6 +6,7 @@ import { timer } from 'rxjs'; |
|
|
import { ConfirmationComponent } from '../components'; |
|
|
import { ConfirmationComponent } from '../components'; |
|
|
import { Confirmation } from '../models'; |
|
|
import { Confirmation } from '../models'; |
|
|
import { ConfirmationService } from '../services'; |
|
|
import { ConfirmationService } from '../services'; |
|
|
|
|
|
import { CONFIRMATION_ICONS, DEFAULT_CONFIRMATION_ICONS } from '../tokens/confirmation-icons.token'; |
|
|
|
|
|
|
|
|
@NgModule({ |
|
|
@NgModule({ |
|
|
exports: [ConfirmationComponent], |
|
|
exports: [ConfirmationComponent], |
|
|
@ -21,6 +22,7 @@ describe('ConfirmationService', () => { |
|
|
const createService = createServiceFactory({ |
|
|
const createService = createServiceFactory({ |
|
|
service: ConfirmationService, |
|
|
service: ConfirmationService, |
|
|
imports: [CoreTestingModule.withConfig(), MockModule], |
|
|
imports: [CoreTestingModule.withConfig(), MockModule], |
|
|
|
|
|
providers: [{ provide: CONFIRMATION_ICONS, useValue: DEFAULT_CONFIRMATION_ICONS }], |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
beforeEach(() => { |
|
|
beforeEach(() => { |
|
|
@ -61,27 +63,27 @@ describe('ConfirmationService', () => { |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
test('should display custom FA icon', fakeAsync(() => { |
|
|
test('should display custom FA icon', fakeAsync(() => { |
|
|
service.show('MESSAGE', 'TITLE',undefined,{ |
|
|
service.show('MESSAGE', 'TITLE', undefined, { |
|
|
icon:'fa fa-info' |
|
|
icon: 'fa fa-info', |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
tick(); |
|
|
tick(); |
|
|
expect(selectConfirmationElement(".icon").className).toBe('icon fa fa-info') |
|
|
expect(selectConfirmationElement('.icon').className).toBe('icon fa fa-info'); |
|
|
})); |
|
|
})); |
|
|
|
|
|
|
|
|
test('should display custom icon as html element', fakeAsync(() => { |
|
|
test('should display custom icon as html element', fakeAsync(() => { |
|
|
const className = 'custom-icon' |
|
|
const className = 'custom-icon'; |
|
|
const selector = '.'+className; |
|
|
const selector = '.' + className; |
|
|
|
|
|
|
|
|
service.show('MESSAGE', 'TITLE',undefined,{ |
|
|
service.show('MESSAGE', 'TITLE', undefined, { |
|
|
iconTemplate: `<span class="${className}">I am icon</span>` |
|
|
iconTemplate: `<span class="${className}">I am icon</span>`, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
tick(); |
|
|
tick(); |
|
|
|
|
|
|
|
|
const element = selectConfirmationElement(selector) |
|
|
const element = selectConfirmationElement(selector); |
|
|
expect(element).toBeTruthy() |
|
|
expect(element).toBeTruthy(); |
|
|
expect(element.innerHTML).toBe("I am icon") |
|
|
expect(element.innerHTML).toBe('I am icon'); |
|
|
})); |
|
|
})); |
|
|
test.each` |
|
|
test.each` |
|
|
type | selector | icon |
|
|
type | selector | icon |
|
|
|