From 00193489b867d98e9df374f55954859e40dad90d Mon Sep 17 00:00:00 2001 From: Diyan Dimitrov Date: Thu, 17 Jan 2019 18:19:13 +0200 Subject: [PATCH] test(search): add test for issue #3631 --- .../src/lib/grids/grid/grid.search.spec.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/projects/igniteui-angular/src/lib/grids/grid/grid.search.spec.ts b/projects/igniteui-angular/src/lib/grids/grid/grid.search.spec.ts index 5f38065840e..46bb09c91b2 100644 --- a/projects/igniteui-angular/src/lib/grids/grid/grid.search.spec.ts +++ b/projects/igniteui-angular/src/lib/grids/grid/grid.search.spec.ts @@ -11,6 +11,7 @@ import { DefaultSortingStrategy } from '../../data-operations/sorting-strategy'; import { configureTestSuite } from '../../test-utils/configure-suite'; import { wait } from '../../test-utils/ui-interactions.spec'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { DataType } from '../../data-operations/data-util'; describe('IgxGrid - search API', () => { configureTestSuite(); @@ -464,6 +465,33 @@ describe('IgxGrid - search API', () => { expect(activeHighlight).toBe(highlights[0]); }); + it('Highlight should be updated when a column is hidden/shown and columns have different data types', () => { + grid.columns[0].dataType = DataType.Number; + fix.detectChanges(); + + let cell = grid.getCellByColumn(0, 'ID').nativeElement; + let activeHighlight: any; + let highlights: any[]; + + grid.findNext('1'); + + activeHighlight = cell.querySelector('.' + component.activeClass); + highlights = cell.querySelectorAll('.' + component.highlightClass); + expect(highlights.length).toBe(1); + expect(activeHighlight).toBe(highlights[0]); + + grid.columns[0].hidden = true; + fix.detectChanges(); + + grid.columns[0].hidden = false; + fix.detectChanges(); + + cell = grid.getCellByColumn(0, 'ID').nativeElement; + highlights = cell.querySelectorAll('.' + component.highlightClass); + expect(highlights.length).toBe(1); + expect(cell.innerText).toBe('1'); + }); + it('Clear filter properly updates the highlights', async () => { let gilbertoDirectorCell = grid.getCellByColumn(1, 'JobTitle').nativeElement; let tanyaDirectorCell = grid.getCellByColumn(2, 'JobTitle').nativeElement;