@@ -331,15 +331,15 @@ describe('IgxGrid - search API', () => {
331
331
grid . findNext ( searchString ) ;
332
332
grid . findNext ( searchString ) ;
333
333
334
- grid . sort ( { fieldName : 'JobTitle' , dir : SortingDirection . Asc , ignoreCase : true } ) ;
334
+ grid . sort ( { fieldName : 'JobTitle' , dir : SortingDirection . Asc , ignoreCase : true } ) ;
335
335
fix . detectChanges ( ) ;
336
336
337
337
activeHighlight = rv . querySelector ( '.' + component . activeClass ) ;
338
338
let highlights = rv . querySelectorAll ( '.' + component . highlightClass ) ;
339
339
expect ( highlights . length ) . toBe ( 1 ) ;
340
340
expect ( activeHighlight ) . toBe ( highlights [ 0 ] ) ;
341
341
342
- grid . sort ( { fieldName : 'JobTitle' , dir : SortingDirection . Desc , ignoreCase : true } ) ;
342
+ grid . sort ( { fieldName : 'JobTitle' , dir : SortingDirection . Desc , ignoreCase : true } ) ;
343
343
fix . detectChanges ( ) ;
344
344
const scrolledCell = grid . getCellByColumn ( grid . data . length - 1 , 'JobTitle' ) . nativeElement ;
345
345
@@ -530,13 +530,13 @@ describe('IgxGrid - search API', () => {
530
530
grid . columns [ 1 ] . hidden = true ;
531
531
fix . detectChanges ( ) ;
532
532
533
- let finds = grid . findNext ( 'Director' ) ;
533
+ let finds = grid . findNext ( 'Director' ) ;
534
534
expect ( finds ) . toEqual ( 2 ) ;
535
535
536
536
grid . columns [ 2 ] . hidden = true ;
537
537
fix . detectChanges ( ) ;
538
538
539
- finds = grid . findNext ( 'Director' ) ;
539
+ finds = grid . findNext ( 'Director' ) ;
540
540
expect ( finds ) . toEqual ( 0 ) ;
541
541
} ) ;
542
542
@@ -786,6 +786,47 @@ describe('IgxGrid - search API', () => {
786
786
expect ( ( highlights [ 0 ] as HTMLElement ) . innerText ) . toEqual ( '12' ) ;
787
787
} ) ;
788
788
} ) ;
789
+
790
+ it ( 'Search should close row edit mode' , async ( ) => {
791
+ grid . primaryKey = 'ID' ;
792
+ grid . rowEditable = true ;
793
+ grid . getColumnByName ( 'Name' ) . editable = true ;
794
+ grid . cdr . detectChanges ( ) ;
795
+ fix . detectChanges ( ) ;
796
+ await wait ( ) ;
797
+ const row = grid . getRowByIndex ( 0 ) ;
798
+ const cell = grid . getCellByColumn ( 0 , 'Name' ) ;
799
+
800
+ grid . findNext ( 'Casey' ) ;
801
+ grid . cdr . detectChanges ( ) ;
802
+ fix . detectChanges ( ) ;
803
+ await wait ( ) ;
804
+
805
+ let highlights = cell . nativeElement . querySelectorAll ( '.' + fix . componentInstance . highlightClass ) ;
806
+ expect ( highlights . length ) . toBe ( 1 ) ;
807
+ expect ( row . inEditMode ) . toBe ( false ) ;
808
+ cell . nativeElement . dispatchEvent ( new Event ( 'dblclick' ) ) ;
809
+ fix . detectChanges ( ) ;
810
+ await wait ( ) ;
811
+
812
+ expect ( row . inEditMode ) . toBe ( true ) ;
813
+
814
+ let cellInput = null ;
815
+ cellInput = cell . nativeElement . querySelector ( '[igxinput]' ) ;
816
+ cellInput . value = 'newCellValue' ;
817
+ cellInput . dispatchEvent ( new Event ( 'input' ) ) ;
818
+ fix . detectChanges ( ) ;
819
+ await wait ( ) ;
820
+
821
+ grid . findNext ( 'Casey' ) ;
822
+ grid . cdr . detectChanges ( ) ;
823
+ fix . detectChanges ( ) ;
824
+ await wait ( ) ;
825
+
826
+ highlights = cell . nativeElement . querySelectorAll ( '.' + fix . componentInstance . highlightClass ) ;
827
+ expect ( highlights . length ) . toBe ( 1 ) ;
828
+ expect ( row . inEditMode ) . toBe ( false ) ;
829
+ } ) ;
789
830
} ) ;
790
831
791
832
/* ScrollableGrid */
0 commit comments