Skip to content

Commit

Permalink
test(search): fixing search tests #3637
Browse files Browse the repository at this point in the history
  • Loading branch information
DiyanDimitrov committed Jan 17, 2019
1 parent 08695fd commit 4af9ebf
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions projects/igniteui-angular/src/lib/grids/grid/grid.search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ describe('IgxGrid - search API', () => {
expect(isInView(3, grid.rowList.first.virtDirRow.state)).toBeTruthy();
});

it('should keep the active highlight when active cell enters and exits edit mode', () => {
pending('When the cell enters edit mode, the highlight stays and the content is doubled! Happens in tests only!');
fit('should keep the active highlight when active cell enters and exits edit mode', async () => {
// pending('When the cell enters edit mode, the highlight stays and the content is doubled! Happens in tests only!');
const rv = fix.debugElement.query(By.css(CELL_CSS_CLASS)).nativeElement;
const cell = grid.getCellByColumn(0, 'ID');
const initialValue = rv.textContent;
Expand All @@ -724,30 +724,34 @@ describe('IgxGrid - search API', () => {

cell.column.editable = true;
fix.detectChanges();
await wait(16);

grid.findNext('1');

activeHighlight = rv.querySelector('.' + component.activeClass);
expect(activeHighlight).not.toBeNull();

cell.inEditMode = true;
// fix.detectChanges();
await wait(16);
fix.detectChanges();

expect(cell.inEditMode).toBe(true);
activeHighlight = rv.querySelector('.' + component.activeClass);
expect(activeHighlight).toBeNull();

cell.inEditMode = false;
await wait(16);
fix.detectChanges();

expect(rv.textContent).toBe(initialValue);
expect(rv.innerText).toBe(initialValue);
expect(rv.querySelectorAll('.' + component.highlightClass).length).toBe(1);
activeHighlight = rv.querySelector('.' + component.activeClass);
expect(activeHighlight).not.toBeNull();
});

it('should update highlights when a new value is entered', () => {
pending('When the cell enters edit mode, the highlight stays and the content is doubled! Happens in tests only!');
fit('should update highlights when a new value is entered', async () => {
// pending('When the cell enters edit mode, the highlight stays and the content is doubled! Happens in tests only!');

const rv = fix.debugElement.query(By.css(CELL_CSS_CLASS));
const cell = grid.getCellByColumn(0, 'ID');
Expand All @@ -774,8 +778,9 @@ describe('IgxGrid - search API', () => {

cell.update(inputElem.value);
fix.detectChanges();
await wait(16);

expect(rv.nativeElement.textContent).toBe('11');
expect(rv.nativeElement.innerText).toBe('11');
activeHighlight = rv.nativeElement.querySelector('.' + component.activeClass);
const highlights = rv.nativeElement.querySelectorAll('.' + component.highlightClass);
expect(highlights.length).toBe(2);
Expand Down

0 comments on commit 4af9ebf

Please sign in to comment.