@@ -77,7 +77,7 @@ export function main() {
7777 } ) ;
7878 } ) ) ;
7979
80- it ( 'should reflect changes when records in the grid are updated/added/deleted ' ,
80+ it ( 'should reflect changes when records in the grid are updated' ,
8181 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
8282 var template = '<div><ig-hierarchical-grid [(widgetId)]="gridID" [(options)]="opts" [changeDetectionInterval]="cdi"></ig-hierarchical-grid></div>' ;
8383 tcb . overrideTemplate ( TestComponent , template )
@@ -91,25 +91,48 @@ export function main() {
9191 fixture . detectChanges ( ) ;
9292 var fName = fixture . componentInstance . data [ 0 ] . FirstName ;
9393 expect ( fName ) . toBe ( "Maria" ) ;
94- //delete row
95- $ ( "#grid1" ) . igGridUpdating ( "deleteRow" , 2 ) ;
96- setTimeout ( ( ) => {
97- fixture . detectChanges ( ) ;
98- expect ( fixture . componentInstance . data . length ) . toBe ( 8 ) ;
99- expect ( fixture . componentInstance . data [ 1 ] . EmployeeID ) . toBe ( 3 ) ;
100- //add row
101- $ ( "#grid1" ) . igGridUpdating ( "addRow" , { EmployeeID : 200 , LastName : "Snow" , FirstName : "John" , Title : "Vice President, Sales" } ) ;
102- setTimeout ( ( ) => {
103- fixture . detectChanges ( ) ;
104- expect ( fixture . componentInstance . data . length ) . toBe ( 9 ) ;
105- expect ( fixture . componentInstance . data [ 8 ] . EmployeeID ) . toBe ( 200 ) ;
106- async . done ( ) ;
107- } , 10 ) ;
108- } , 10 ) ;
109- } , 10 ) ;
94+ async . done ( ) ;
95+ } , 10 ) ;
11096 } ) ;
11197 } ) ) ;
11298
99+ it ( 'should reflect changes when records in the grid are deleted' ,
100+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
101+ var template = '<div><ig-hierarchical-grid [(widgetId)]="gridID" [(options)]="opts" [changeDetectionInterval]="cdi"></ig-hierarchical-grid></div>' ;
102+ tcb . overrideTemplate ( TestComponent , template )
103+ . createAsync ( TestComponent )
104+ . then ( ( fixture ) => {
105+ fixture . detectChanges ( ) ;
106+ //delete row
107+ $ ( "#grid1" ) . igGridUpdating ( "deleteRow" , 2 ) ;
108+ setTimeout ( ( ) => {
109+ fixture . detectChanges ( ) ;
110+ expect ( fixture . componentInstance . data . length ) . toBe ( 8 ) ;
111+ expect ( fixture . componentInstance . data [ 1 ] . EmployeeID ) . toBe ( 3 ) ;
112+ async . done ( ) ;
113+ } , 10 ) ;
114+ } ) ;
115+ } ) ) ;
116+
117+ it ( 'should reflect changes when records in the grid are added' ,
118+ inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
119+ var template = '<div><ig-hierarchical-grid [(widgetId)]="gridID" [(options)]="opts" [changeDetectionInterval]="cdi"></ig-hierarchical-grid></div>' ;
120+ tcb . overrideTemplate ( TestComponent , template )
121+ . createAsync ( TestComponent )
122+ . then ( ( fixture ) => {
123+ fixture . detectChanges ( ) ;
124+ $ ( "#grid1" ) . igGridUpdating ( "addRow" , { EmployeeID : 200 , LastName : "Snow" , FirstName : "John" , Title : "Vice President, Sales" } ) ;
125+ setTimeout ( ( ) => {
126+ fixture . detectChanges ( ) ;
127+ expect ( fixture . componentInstance . data . length ) . toBe ( 10 ) ;
128+ expect ( fixture . componentInstance . data [ 9 ] . EmployeeID ) . toBe ( 200 ) ;
129+ async . done ( ) ;
130+ } , 10 ) ;
131+ } ) ;
132+ } ) ) ;
133+
134+
135+
113136 it ( 'should reflect changes when child records are changes' ,
114137 inject ( [ TestComponentBuilder , AsyncTestCompleter ] , ( tcb : TestComponentBuilder , async ) => {
115138 var template = '<div><ig-hierarchical-grid [(widgetId)]="gridID" [(options)]="opts" [changeDetectionInterval]="cdi"></ig-hierarchical-grid></div>' ;
0 commit comments