@@ -247,7 +247,7 @@ describe('IgxGrid - Validation #grid', () => {
247
247
fixture . detectChanges ( ) ;
248
248
249
249
GridFunctions . verifyCellValid ( cell , false ) ;
250
- expect ( grid . validationStatusChange . emit ) . toHaveBeenCalledWith ( { status : 'INVALID' , owner : grid } ) ;
250
+ expect ( grid . validationStatusChange . emit ) . toHaveBeenCalledWith ( { status : 'INVALID' , owner : grid } ) ;
251
251
252
252
UIInteractions . simulateDoubleClickAndSelectEvent ( cell . element ) ;
253
253
cell . editMode = true ;
@@ -259,7 +259,7 @@ describe('IgxGrid - Validation #grid', () => {
259
259
fixture . detectChanges ( ) ;
260
260
261
261
GridFunctions . verifyCellValid ( cell , true ) ;
262
- expect ( grid . validationStatusChange . emit ) . toHaveBeenCalledWith ( { status : 'INVALID' , owner : grid } ) ;
262
+ expect ( grid . validationStatusChange . emit ) . toHaveBeenCalledWith ( { status : 'INVALID' , owner : grid } ) ;
263
263
} ) ;
264
264
265
265
it ( 'should return invalid transaction using the transaction service API' , ( ) => {
@@ -407,7 +407,7 @@ describe('IgxGrid - Validation #grid', () => {
407
407
const grid = fixture . componentInstance . grid as IgxGridComponent ;
408
408
let cell = grid . gridAPI . get_cell_by_visible_index ( 1 , 1 ) ;
409
409
410
- grid . updateCell ( 'IG' , 2 , 'ProductName' ) ;
410
+ grid . updateCell ( 'IG' , 2 , 'ProductName' ) ;
411
411
grid . validation . markAsTouched ( 2 ) ;
412
412
fixture . detectChanges ( ) ;
413
413
@@ -525,6 +525,44 @@ describe('IgxGrid - Validation #grid', () => {
525
525
expect ( ( grid . validation as any ) . getValidity ( ) . length ) . toEqual ( 0 ) ;
526
526
} ) ;
527
527
528
+ it ( 'should update validity when all transactions are cleared' , ( ) => {
529
+ const grid = fixture . componentInstance . grid as IgxGridComponent ;
530
+ let cell = grid . gridAPI . get_cell_by_visible_index ( 1 , 1 ) ;
531
+ let secondCell = grid . gridAPI . get_cell_by_visible_index ( 2 , 1 ) ;
532
+
533
+ // update first cell
534
+ UIInteractions . simulateDoubleClickAndSelectEvent ( cell . element ) ;
535
+ cell . editMode = true ;
536
+ cell . update ( 'IG' ) ;
537
+ fixture . detectChanges ( ) ;
538
+
539
+ grid . gridAPI . crudService . endEdit ( true ) ;
540
+ fixture . detectChanges ( ) ;
541
+
542
+ GridFunctions . verifyCellValid ( cell , false ) ;
543
+
544
+ //update second cell
545
+ UIInteractions . simulateDoubleClickAndSelectEvent ( secondCell . element ) ;
546
+ secondCell . editMode = true ;
547
+ secondCell . update ( 'bob' ) ;
548
+ fixture . detectChanges ( ) ;
549
+
550
+ grid . gridAPI . crudService . endEdit ( true ) ;
551
+ fixture . detectChanges ( ) ;
552
+ GridFunctions . verifyCellValid ( cell , false ) ;
553
+ expect ( grid . validation . getInvalid ( ) . length ) . toBe ( 2 ) ;
554
+
555
+
556
+ // clear transactions
557
+ grid . transactions . clear ( ) ;
558
+ fixture . detectChanges ( ) ;
559
+ expect ( grid . validation . getInvalid ( ) . length ) . toBe ( 0 ) ;
560
+
561
+
562
+ grid . validation . clear ( ) ;
563
+ fixture . detectChanges ( ) ;
564
+ } ) ;
565
+
528
566
it ( 'should not show errors when the row is deleted' , ( ) => {
529
567
const grid = fixture . componentInstance . grid as IgxGridComponent ;
530
568
let cell = grid . gridAPI . get_cell_by_visible_index ( 1 , 1 ) ;
0 commit comments