mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
@@ -277,6 +277,8 @@ describe('ActivitiStartProcessButton', () => {
|
||||
|
||||
describe('cancel dialog', () => {
|
||||
|
||||
let dialogPolyfill: any;
|
||||
|
||||
let setupDialog = (definitions?: any) => {
|
||||
if (definitions) {
|
||||
getDefinitionsSpy.and.returnValue(Observable.of(definitions));
|
||||
@@ -292,6 +294,12 @@ describe('ActivitiStartProcessButton', () => {
|
||||
closeButton.triggerEventHandler('click', null);
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
dialogPolyfill = { registerDialog: (widget) => widget.showModal = () => {} };
|
||||
dialogPolyfill.registerDialog = spyOn(dialogPolyfill, 'registerDialog').and.callThrough();
|
||||
window['dialogPolyfill'] = dialogPolyfill;
|
||||
});
|
||||
|
||||
it('should close dialog when cancel button clicked', async(() => {
|
||||
let closeSpy = spyOn(component.dialog.nativeElement, 'close');
|
||||
component.showDialog();
|
||||
@@ -321,6 +329,13 @@ describe('ActivitiStartProcessButton', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should register dialog via polyfill', () => {
|
||||
fixture.detectChanges();
|
||||
component.dialog.nativeElement.showModal = null;
|
||||
component.showDialog();
|
||||
expect(dialogPolyfill.registerDialog).toHaveBeenCalledWith(component.dialog.nativeElement);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user