Skip to content

Commit 5a9f07a

Browse files
authored
Merge pull request #5017 from IgniteUI/nrobakova/fix-issue-4902-master
Remove refreshSearch form the escape_editMode method
2 parents af61717 + ef2fe5c commit 5a9f07a

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

projects/igniteui-angular/src/lib/grids/api.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export class GridBaseAPIService <T extends IgxGridBaseComponent & IGridDataBinda
6565
// TODO: Refactor
6666
public escape_editMode() {
6767
this.grid.crudService.end();
68-
this.grid.refreshSearch();
6968
}
7069

7170
// TODO: Refactor

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

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,15 @@ describe('IgxGrid - search API', () => {
331331
grid.findNext(searchString);
332332
grid.findNext(searchString);
333333

334-
grid.sort({fieldName: 'JobTitle', dir: SortingDirection.Asc, ignoreCase: true });
334+
grid.sort({ fieldName: 'JobTitle', dir: SortingDirection.Asc, ignoreCase: true });
335335
fix.detectChanges();
336336

337337
activeHighlight = rv.querySelector('.' + component.activeClass);
338338
let highlights = rv.querySelectorAll('.' + component.highlightClass);
339339
expect(highlights.length).toBe(1);
340340
expect(activeHighlight).toBe(highlights[0]);
341341

342-
grid.sort({fieldName: 'JobTitle', dir: SortingDirection.Desc, ignoreCase: true });
342+
grid.sort({ fieldName: 'JobTitle', dir: SortingDirection.Desc, ignoreCase: true });
343343
fix.detectChanges();
344344
const scrolledCell = grid.getCellByColumn(grid.data.length - 1, 'JobTitle').nativeElement;
345345

@@ -530,13 +530,13 @@ describe('IgxGrid - search API', () => {
530530
grid.columns[1].hidden = true;
531531
fix.detectChanges();
532532

533-
let finds = grid.findNext('Director');
533+
let finds = grid.findNext('Director');
534534
expect(finds).toEqual(2);
535535

536536
grid.columns[2].hidden = true;
537537
fix.detectChanges();
538538

539-
finds = grid.findNext('Director');
539+
finds = grid.findNext('Director');
540540
expect(finds).toEqual(0);
541541
});
542542

@@ -786,6 +786,47 @@ describe('IgxGrid - search API', () => {
786786
expect((highlights[0] as HTMLElement).innerText).toEqual('12');
787787
});
788788
});
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+
});
789830
});
790831

791832
/* ScrollableGrid */

0 commit comments

Comments
 (0)