From e0fcadf8c568a72cb078a66726ba5eea5aa8f525 Mon Sep 17 00:00:00 2001 From: Oleg Pimenov Date: Mon, 6 Aug 2018 23:31:15 +0300 Subject: [PATCH] updated autoFocus and unit tests --- src/lib/modal/modal-control.service.ts | 5 +- src/lib/modal/modal.component.html | 2 +- src/lib/modal/modal.component.ts | 24 +++- src/lib/modal/modal.spec.ts | 149 ++++++++++++++++--------- 4 files changed, 121 insertions(+), 59 deletions(-) diff --git a/src/lib/modal/modal-control.service.ts b/src/lib/modal/modal-control.service.ts index ee59f2554..652d4a201 100644 --- a/src/lib/modal/modal-control.service.ts +++ b/src/lib/modal/modal-control.service.ts @@ -12,6 +12,7 @@ interface IRegisteredMeta { @Injectable() export class McModalControlService { + // Track singleton afterAllClose through over the injection tree get afterAllClose(): Subject { return this.parentService ? this.parentService.afterAllClose : this.rootAfterAllClose; @@ -26,11 +27,11 @@ export class McModalControlService { private rootOpenModals: McModalRef[] = this.parentService ? null : []; // @ts-ignore private rootAfterAllClose: Subject = this.parentService ? null : new Subject(); - // @ts-ignore private rootRegisteredMetaMap: Map = this.parentService ? null : new Map(); - private get registeredMetaMap(): Map { // Registered modal for later usage + // Registered modal for later usage + private get registeredMetaMap(): Map { return this.parentService ? this.parentService.registeredMetaMap : this.rootRegisteredMetaMap; } diff --git a/src/lib/modal/modal.component.html b/src/lib/modal/modal.component.html index 09c80c515..d4d296c67 100644 --- a/src/lib/modal/modal.component.html +++ b/src/lib/modal/modal.component.html @@ -116,7 +116,7 @@
-