Add additional test for dialog polyfill

Refs #1066
This commit is contained in:
Will Abson
2016-11-18 14:00:58 +00:00
committed by Mario Romano
parent 7013918d35
commit d2e0444dca

View File

@@ -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);
});
});
});