66 ViewChild ,
77 ViewContainerRef ,
88 ViewEncapsulation ,
9- inject as inject_1 ,
9+ inject ,
1010} from '@angular/core' ;
1111import { ComponentFixture , TestBed , waitForAsync } from '@angular/core/testing' ;
1212import { By } from '@angular/platform-browser' ;
@@ -217,16 +217,13 @@ describe('FocusTrap', () => {
217217 fixture . componentInstance . showTrappedRegion = true ;
218218 fixture . changeDetectorRef . markForCheck ( ) ;
219219 fixture . detectChanges ( ) ;
220+ expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
220221
221- fixture . whenStable ( ) . then ( ( ) => {
222- expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
223-
224- fixture . componentInstance . showTrappedRegion = false ;
225- fixture . changeDetectorRef . markForCheck ( ) ;
226- fixture . detectChanges ( ) ;
222+ fixture . componentInstance . showTrappedRegion = false ;
223+ fixture . changeDetectorRef . markForCheck ( ) ;
224+ fixture . detectChanges ( ) ;
227225
228- expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
229- } ) ;
226+ expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
230227 } ) ) ;
231228
232229 it ( 'should capture focus if auto capture is enabled later on' , waitForAsync ( ( ) => {
@@ -243,16 +240,13 @@ describe('FocusTrap', () => {
243240 fixture . componentInstance . autoCaptureEnabled = true ;
244241 fixture . changeDetectorRef . markForCheck ( ) ;
245242 fixture . detectChanges ( ) ;
243+ expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
246244
247- fixture . whenStable ( ) . then ( ( ) => {
248- expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
249-
250- fixture . componentInstance . showTrappedRegion = false ;
251- fixture . changeDetectorRef . markForCheck ( ) ;
252- fixture . detectChanges ( ) ;
245+ fixture . componentInstance . showTrappedRegion = false ;
246+ fixture . changeDetectorRef . markForCheck ( ) ;
247+ fixture . detectChanges ( ) ;
253248
254- expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
255- } ) ;
249+ expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
256250 } ) ) ;
257251
258252 it ( 'should automatically capture and return focus on init / destroy inside the shadow DOM' , waitForAsync ( ( ) => {
@@ -270,16 +264,13 @@ describe('FocusTrap', () => {
270264 fixture . componentInstance . showTrappedRegion = true ;
271265 fixture . changeDetectorRef . markForCheck ( ) ;
272266 fixture . detectChanges ( ) ;
267+ expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
273268
274- fixture . whenStable ( ) . then ( ( ) => {
275- expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
276-
277- fixture . componentInstance . showTrappedRegion = false ;
278- fixture . changeDetectorRef . markForCheck ( ) ;
279- fixture . detectChanges ( ) ;
269+ fixture . componentInstance . showTrappedRegion = false ;
270+ fixture . changeDetectorRef . markForCheck ( ) ;
271+ fixture . detectChanges ( ) ;
280272
281- expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
282- } ) ;
273+ expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
283274 } ) ) ;
284275
285276 it ( 'should capture focus if auto capture is enabled later on inside the shadow DOM' , waitForAsync ( ( ) => {
@@ -300,16 +291,13 @@ describe('FocusTrap', () => {
300291 fixture . componentInstance . autoCaptureEnabled = true ;
301292 fixture . changeDetectorRef . markForCheck ( ) ;
302293 fixture . detectChanges ( ) ;
294+ expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
303295
304- fixture . whenStable ( ) . then ( ( ) => {
305- expect ( getActiveElement ( ) . id ) . toBe ( 'auto-capture-target' ) ;
306-
307- fixture . componentInstance . showTrappedRegion = false ;
308- fixture . changeDetectorRef . markForCheck ( ) ;
309- fixture . detectChanges ( ) ;
296+ fixture . componentInstance . showTrappedRegion = false ;
297+ fixture . changeDetectorRef . markForCheck ( ) ;
298+ fixture . detectChanges ( ) ;
310299
311- expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
312- } ) ;
300+ expect ( getActiveElement ( ) ) . toBe ( buttonOutsideTrappedRegion ) ;
313301 } ) ) ;
314302 } ) ;
315303
@@ -473,7 +461,7 @@ class FocusTrapWithoutFocusableElements {
473461 imports : [ A11yModule , PortalModule ] ,
474462} )
475463class FocusTrapInsidePortal {
476- viewContainerRef = inject_1 ( ViewContainerRef ) ;
464+ viewContainerRef = inject ( ViewContainerRef ) ;
477465
478466 @ViewChild ( 'template' ) template : TemplateRef < any > ;
479467 @ViewChild ( CdkPortalOutlet ) portalOutlet : CdkPortalOutlet ;
0 commit comments