@@ -29,7 +29,9 @@ describe('igxGridEditingActions #grid ', () => {
29
29
IgxActionStripPinEditComponent ,
30
30
IgxActionStripEditMenuComponent ,
31
31
IgxHierarchicalGridActionStripComponent ,
32
- IgxTreeGridEditActionsComponent
32
+ IgxTreeGridEditActionsComponent ,
33
+ IgxActionStripOneRowComponent ,
34
+ IgxActionStripMenuOneRowComponent
33
35
] ,
34
36
imports : [
35
37
NoopAnimationsModule ,
@@ -153,6 +155,28 @@ describe('igxGridEditingActions #grid ', () => {
153
155
154
156
expect ( grid . rowList . first . data [ 'ID' ] ) . toBe ( 'ANATR' ) ;
155
157
} ) ;
158
+ it ( 'should not auto-hide on mouse leave of row if action strip is menu' , ( ) => {
159
+ fixture = TestBed . createComponent ( IgxActionStripMenuOneRowComponent ) ;
160
+ fixture . detectChanges ( ) ;
161
+ actionStrip = fixture . componentInstance . actionStrip ;
162
+ grid = fixture . componentInstance . grid ;
163
+
164
+ const row = grid . getRowByIndex ( 0 ) ;
165
+ row . pin ( ) ;
166
+ const rowElem = grid . pinnedRows [ 0 ] ;
167
+ row . unpin ( ) ;
168
+
169
+ actionStrip . show ( row ) ;
170
+ fixture . detectChanges ( ) ;
171
+
172
+ actionStrip . menu . open ( ) ;
173
+ fixture . detectChanges ( ) ;
174
+
175
+ UIInteractions . simulateMouseEvent ( 'mouseleave' , rowElem . element . nativeElement , 0 , 200 ) ;
176
+ fixture . detectChanges ( ) ;
177
+
178
+ expect ( actionStrip . hidden ) . toBeFalse ( ) ;
179
+ } ) ;
156
180
} ) ;
157
181
158
182
describe ( 'integration with pinning actions ' , ( ) => {
@@ -191,6 +215,25 @@ describe('igxGridEditingActions #grid ', () => {
191
215
expect ( actionStrip . context ) . toBe ( row ) ;
192
216
expect ( actionStrip . hidden ) . toBeFalse ( ) ;
193
217
} ) ;
218
+ it ( 'should auto-hide on mouse leave of row.' , async ( ) => {
219
+ fixture = TestBed . createComponent ( IgxActionStripOneRowComponent ) ;
220
+ fixture . detectChanges ( ) ;
221
+ actionStrip = fixture . componentInstance . actionStrip ;
222
+ grid = fixture . componentInstance . grid ;
223
+
224
+ const row = grid . getRowByIndex ( 0 ) ;
225
+ row . pin ( ) ;
226
+ const rowElem = grid . pinnedRows [ 0 ] ;
227
+
228
+ actionStrip . show ( row ) ;
229
+ fixture . detectChanges ( ) ;
230
+
231
+ expect ( actionStrip . hidden ) . toBeFalse ( ) ;
232
+ UIInteractions . simulateMouseEvent ( 'mouseleave' , rowElem . element . nativeElement , 0 , 200 ) ;
233
+ fixture . detectChanges ( ) ;
234
+
235
+ expect ( actionStrip . hidden ) . toBeTrue ( ) ;
236
+ } ) ;
194
237
it ( 'should auto-hide on mouse leave of grid.' , ( ) => {
195
238
const row = grid . getRowByIndex ( 0 ) ;
196
239
actionStrip . show ( row ) ;
@@ -329,6 +372,7 @@ class IgxActionStripTestingComponent implements OnInit {
329
372
public grid : IgxGridComponent ;
330
373
331
374
private data : any [ ] ;
375
+ private dataOneRow : any [ ] ;
332
376
private columns : any [ ] ;
333
377
334
378
public ngOnInit ( ) {
@@ -377,6 +421,10 @@ class IgxActionStripTestingComponent implements OnInit {
377
421
{ ID : 'FRANS' , CompanyName : 'Franchi S.p.A.' , ContactName : 'Paolo Accorti' , ContactTitle : 'Sales Representative' , Address : 'Via Monte Bianco 34' , City : 'Torino' , Region : null , PostalCode : '10100' , Country : 'Italy' , Phone : '011-4988260' , Fax : '011-4988261' }
378
422
] ;
379
423
/* eslint-enable max-len */
424
+
425
+ this . dataOneRow = [
426
+ { ID : 'ALFKI' , CompanyName : 'Alfreds Futterkiste' , ContactName : 'Maria Anders' , ContactTitle : 'Sales Representative' , Address : 'Obere Str. 57' , City : 'Berlin' , Region : null , PostalCode : '12209' , Country : 'Germany' , Phone : '030-0074321' , Fax : '030-0076545' } ,
427
+ ] ;
380
428
}
381
429
}
382
430
@@ -414,3 +462,38 @@ class IgxActionStripPinEditComponent extends IgxActionStripTestingComponent {
414
462
} )
415
463
class IgxActionStripEditMenuComponent extends IgxActionStripTestingComponent {
416
464
}
465
+
466
+ @Component ( {
467
+ template : `
468
+ <igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
469
+ [rowEditable]="true" [primaryKey]="'ID'">
470
+ <igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
471
+ [width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
472
+ </igx-column>
473
+
474
+ <igx-action-strip #actionStrip>
475
+ <igx-grid-pinning-actions></igx-grid-pinning-actions>
476
+ <igx-grid-editing-actions></igx-grid-editing-actions>
477
+ </igx-action-strip>
478
+ </igx-grid>
479
+ `
480
+ } )
481
+ class IgxActionStripOneRowComponent extends IgxActionStripTestingComponent {
482
+ }
483
+
484
+ @Component ( {
485
+ template : `
486
+ <igx-grid #grid [data]="dataOneRow" [width]="'800px'" [height]="'500px'"
487
+ [rowEditable]="true" [primaryKey]="'ID'">
488
+ <igx-column *ngFor="let c of columns" [sortable]="true" [field]="c.field" [header]="c.field"
489
+ [width]="c.width" [pinned]='c.pinned' [hidden]='c.hidden'>
490
+ </igx-column>
491
+
492
+ <igx-action-strip #actionStrip>
493
+ <igx-grid-editing-actions [asMenuItems]='true'></igx-grid-editing-actions>
494
+ </igx-action-strip>
495
+ </igx-grid>
496
+ `
497
+ } )
498
+ class IgxActionStripMenuOneRowComponent extends IgxActionStripTestingComponent {
499
+ }
0 commit comments