XosConfirm tests
Change-Id: Ia7a8259d3905859d7eaeaa61fd09108238817ae9
(cherry picked from commit 7d32b1e082ba4b346c279b75f16440743560981d)
diff --git a/src/app/core/confirm/confirm.service.ts b/src/app/core/confirm/confirm.service.ts
index a8e802e..39336e3 100644
--- a/src/app/core/confirm/confirm.service.ts
+++ b/src/app/core/confirm/confirm.service.ts
@@ -18,36 +18,44 @@
import {IXosConfirmConfig} from './confirm';
export interface IXosConfirm {
+ modalInstance: any;
open(config: IXosConfirmConfig) : void;
- close(cb: Function) : void;
+ close(cb: any) : void;
dismiss() : void;
}
export class XosConfirm implements IXosConfirm {
- static $inject = ['$uibModal'];
+ static $inject = ['$uibModal', '$log'];
public modalInstance;
constructor(
private $uibModal : any,
+ private $log: ng.ILogService,
) {
}
public open(config: IXosConfirmConfig) {
-
+ this.$log.debug('[XosConfirm] called open');
this.modalInstance = this.$uibModal.open({
- keyboard: false,
+ keyboard: true,
component: 'xosConfirm',
backdrop: 'static',
resolve: {
config: () => config
}
});
+
return this.modalInstance;
}
- public close(cb: Function) {
+ public close(cb: any) {
+ // check if model instance exists
+ if (angular.isUndefined(this.modalInstance)) {
+ this.$log.debug('[XosConfirm] called close without a modalInstance');
+ return;
+ }
cb()
.then(() => {
this.modalInstance.close();