@@ -4,7 +4,8 @@ import { TestBed, fakeAsync, tick, waitForAsync } from '@angular/core/testing';
44import { DebugElement } from '@angular/core' ;
55import { GridFunctions , GridSummaryFunctions } from '../../../test-utils/grid-functions.spec' ;
66import {
7- IgxAddRowComponent , IgxGridRowEditingDefinedColumnsComponent , IgxGridRowEditingTransactionComponent
7+ IgxAddRowComponent , IgxGridRowEditingDefinedColumnsComponent , IgxGridRowEditingTransactionComponent ,
8+ GridDynamicActionStripComponent
89} from '../../../test-utils/grid-samples.spec' ;
910
1011import { By } from '@angular/platform-browser' ;
@@ -45,7 +46,8 @@ describe('IgxGrid - Row Adding #grid', () => {
4546 IgxGridRowEditingTransactionComponent ,
4647 IgxGridRowEditingDefinedColumnsComponent ,
4748 ColumnLayoutTestComponent ,
48- DefaultGridMasterDetailComponent
49+ DefaultGridMasterDetailComponent ,
50+ GridDynamicActionStripComponent
4951 ] ,
5052 providers : [
5153 IgxGridMRLNavigationService
@@ -1121,4 +1123,34 @@ describe('IgxGrid - Row Adding #grid', () => {
11211123 expect ( grid . rowChangesCount ) . toEqual ( 3 ) ;
11221124 } ) ;
11231125 } ) ;
1126+
1127+ describe ( 'ActionStrip - Dynamic Addition' , ( ) => {
1128+ let actionStrip : IgxActionStripComponent ;
1129+
1130+ beforeEach ( ( ) => {
1131+ fixture = TestBed . createComponent ( GridDynamicActionStripComponent ) ;
1132+ fixture . detectChanges ( ) ;
1133+ grid = fixture . componentInstance . grid ;
1134+ } ) ;
1135+
1136+ it ( 'Should set outlet for actionstrip menu when added post-init' , async ( ) => {
1137+ // Verify no actionstrip initially
1138+ expect ( fixture . componentInstance . actionStrip ) . toBeUndefined ( ) ;
1139+ expect ( grid . actionStrip ) . toBeUndefined ( ) ;
1140+
1141+ // Add the actionstrip dynamically
1142+ fixture . componentInstance . showActionStrip = true ;
1143+ fixture . detectChanges ( ) ;
1144+ await wait ( 16 ) ;
1145+
1146+ // Get reference to the actionstrip
1147+ actionStrip = fixture . componentInstance . actionStrip ;
1148+ expect ( actionStrip ) . toBeDefined ( ) ;
1149+ expect ( grid . actionStrip ) . toBeDefined ( ) ;
1150+
1151+ // Verify that the outlet is properly set
1152+ expect ( actionStrip . menuOverlaySettings . outlet ) . toBeDefined ( ) ;
1153+ expect ( actionStrip . menuOverlaySettings . outlet ) . toBe ( grid . outlet ) ;
1154+ } ) ;
1155+ } ) ;
11241156} ) ;
0 commit comments