Skip to content

Commit 833c2da

Browse files
authored
fix(IgxGrid): Fix event args for rowAdded too. Update test. (#14122)
1 parent d645faa commit 833c2da

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

projects/igniteui-angular/src/lib/grids/common/crud.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export class IgxAddRow extends IgxEditRow {
7474
const args = super.createEditEventArgs(includeNewValue, event);
7575
args.oldValue = null;
7676
args.isAddRow = true;
77+
args.rowData = this.newData ?? this.data;
7778
return args;
7879
}
7980

projects/igniteui-angular/src/lib/grids/grid/grid-row-editing.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TestBed, fakeAsync, tick, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { IgxGridComponent } from './grid.component';
6-
import { IGridEditEventArgs, IGridEditDoneEventArgs } from '../common/events';
6+
import { IGridEditDoneEventArgs, IGridEditEventArgs,IRowDataEventArgs } from '../common/events';
77
import { IgxColumnComponent } from '../columns/column.component';
88
import { DisplayDensity } from '../../core/density';
99
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
@@ -292,8 +292,9 @@ describe('IgxGrid - Row Editing #grid', () => {
292292
expect(grid.rowEditDone.emit).toHaveBeenCalledWith(rowDoneArgs);
293293
});
294294

295-
it('Emit rowAdd event with proper arguments', () => {
295+
it('Emit rowAdd and rowAdded event with proper arguments', () => {
296296
spyOn(grid.rowAdd, 'emit').and.callThrough();
297+
spyOn(grid.rowAdded, 'emit').and.callThrough();
297298
// start add row
298299
grid.beginAddRowById(null);
299300
fix.detectChanges();
@@ -328,7 +329,14 @@ describe('IgxGrid - Row Editing #grid', () => {
328329
owner: grid,
329330
isAddRow: true
330331
}
332+
333+
const rowAddedArgs: IRowDataEventArgs = {
334+
data: { ProductID: generatedId, ProductName: "NewValue"},
335+
primaryKey: generatedId,
336+
owner: grid
337+
};
331338
expect(grid.rowAdd.emit).toHaveBeenCalledWith(rowAddArgs);
339+
expect(grid.rowAdded.emit).toHaveBeenCalledWith(rowAddedArgs);
332340
});
333341

334342
it('Should display the banner below the edited row if it is not the last one', () => {

0 commit comments

Comments
 (0)