Skip to content

Commit

Permalink
Revert "fix(filtering): Avoid resetting values for number inputs #6973"
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronosSF authored Apr 21, 2020
1 parent 26b0747 commit e41ae89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { IBaseChipEventArgs, IgxChipsAreaComponent, IgxChipComponent } from '../
import { ExpressionUI } from './grid-filtering.service';
import { IgxDropDownItemComponent } from '../../drop-down/drop-down-item.component';
import { IgxFilteringService } from './grid-filtering.service';
import { KEYS, isEdge, isIE } from '../../core/utils';
import { KEYS, isEdge } from '../../core/utils';
import { AbsoluteScrollStrategy } from '../../services/overlay/scroll';

/**
Expand Down Expand Up @@ -281,11 +281,8 @@ export class IgxGridFilteringRowComponent implements AfterViewInit {
public onInput(eventArgs) {
// The 'iskeyPressed' flag is needed for a case in IE, because the input event is fired on focus and for some reason,
// when you have a japanese character as a placeholder, on init the value here is empty string .
// There is no need to reset the value on every invalid number input.
// The invalid value is converted to empty string input type="number"
const target = eventArgs.target;
if (isEdge() && target.type !== 'number' || this.isKeyPressed && isIE() || target.value) {
this.value = target.value;
if (isEdge() || this.isKeyPressed || eventArgs.target.value) {
this.value = eventArgs.target.value;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
import { HelperUtils } from '../../test-utils/helper-utils.spec';
import { GridSelectionMode, FilterMode } from '../common/enums';

const DEBOUNCETIME = 30;
const FILTER_UI_ROW = 'igx-grid-filtering-row';
const FILTER_UI_CELL = 'igx-grid-filtering-cell';
const FILTER_UI_SCROLL_START_CLASS = '.igx-grid__filtering-row-scroll-start';
Expand Down Expand Up @@ -669,25 +668,6 @@ describe('IgxGrid - Filtering actions #grid', () => {
tick(100);
fix.detectChanges();

sendInput(input, '254..', fix);
tick();
fix.detectChanges();


expect(grid.rowList.length).toEqual(6);
expect(close.nativeElement.classList.contains('igx-button--disabled')).toBeFalsy();
expect(reset.nativeElement.classList.contains('igx-button--disabled')).toBeFalsy();
expect(input.nativeElement.offsetHeight).toBeGreaterThan(0);

// open dropdown
filterIcon.nativeElement.click();
tick();
fix.detectChanges();
// less than or equal to
ddItems[5].click();
tick(100);
fix.detectChanges();

expect(grid.rowList.length).toEqual(6);
expect(close.nativeElement.classList.contains('igx-button--disabled')).toBeFalsy();
expect(reset.nativeElement.classList.contains('igx-button--disabled')).toBeFalsy();
Expand Down Expand Up @@ -2865,9 +2845,9 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
expect(GridFunctions.getCurrentCellFromGrid(grid, 1, 1).value).toBe('Ignite UI for Angular');
}));

it('Verify filter cell chip is scrolled into view on click.', async () => {
it('Verify filter cell chip is scrolled into view on click.', fakeAsync(() => {
grid.width = '470px';
await wait(DEBOUNCETIME);
tick(100);
fix.detectChanges();

// Verify 'ReleaseDate' filter chip is not fully visible.
Expand All @@ -2878,11 +2858,11 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
'chip should not be fully visible and thus not within grid');

GridFunctions.clickFilterCellChip(fix, 'ReleaseDate');
await wait(DEBOUNCETIME);
tick(100);
fix.detectChanges();

grid.filteringRow.close();
await wait();
GridFunctions.closeFilterRow(fix);
tick(100);
fix.detectChanges();

// Verify 'ReleaseDate' filter chip is fully visible.
Expand All @@ -2891,7 +2871,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
gridRect = grid.nativeElement.getBoundingClientRect();
expect(chipRect.left > gridRect.left && chipRect.right < gridRect.right).toBe(true,
'chip should be fully visible and within grid');
});
}));

it('Verify condition chips are scrolled into/(out of) view by using arrow buttons.', (async () => {
grid.width = '700px';
Expand Down

0 comments on commit e41ae89

Please sign in to comment.