diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts index 77920d296a..eaec6f2f4b 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-start-process.component.spec.ts @@ -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); + }); + }); });