Skip to content

Commit 19a5213

Browse files
authored
Merge branch 'master' into mkirova/partial-fix-13993
2 parents b3a5022 + 84378e8 commit 19a5213

File tree

9 files changed

+165
-67
lines changed

9 files changed

+165
-67
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,71 +1745,60 @@ describe('igxCombo', () => {
17451745
expect(dropdown).toBeDefined();
17461746
expect(dropdown.focusedItem).toBeFalsy();
17471747
expect(combo.virtualScrollContainer).toBeDefined();
1748+
combo.allowCustomValues = true;
17481749
const mockClick = jasmine.createSpyObj('event', ['preventDefault', 'stopPropagation']);
17491750
const virtualMockUP = spyOn<any>(dropdown, 'navigatePrev').and.callThrough();
17501751
const virtualMockDOWN = spyOn<any>(dropdown, 'navigateNext').and.callThrough();
17511752
expect(dropdown.focusedItem).toEqual(null);
17521753
expect(combo.collapsed).toBeTruthy();
17531754
combo.toggle();
1754-
await wait(30);
1755+
await wait();
17551756
fixture.detectChanges();
17561757
expect(combo.collapsed).toBeFalsy();
17571758
combo.virtualScrollContainer.scrollTo(51);
1758-
await wait(30);
1759+
await firstValueFrom(combo.virtualScrollContainer.chunkLoad);
17591760
fixture.detectChanges();
17601761
let items = fixture.debugElement.queryAll(By.css(`.${CSS_CLASS_DROPDOWNLISTITEM}`));
17611762
let lastItem = items[items.length - 1].componentInstance;
17621763
expect(lastItem).toBeDefined();
17631764
lastItem.clicked(mockClick);
1764-
await wait(30);
17651765
fixture.detectChanges();
17661766
expect(dropdown.focusedItem).toEqual(lastItem);
17671767
dropdown.navigateItem(-1);
1768-
await wait(30);
17691768
fixture.detectChanges();
17701769
expect(virtualMockDOWN).toHaveBeenCalledTimes(0);
17711770
lastItem.clicked(mockClick);
1772-
await wait(30);
17731771
fixture.detectChanges();
17741772
expect(dropdown.focusedItem).toEqual(lastItem);
17751773
dropdown.navigateNext();
1776-
await wait(30);
17771774
fixture.detectChanges();
17781775
expect(virtualMockDOWN).toHaveBeenCalledTimes(1);
17791776
combo.searchValue = 'New';
17801777
combo.handleInputChange();
17811778
fixture.detectChanges();
1782-
await wait(30);
1783-
items = fixture.debugElement.queryAll(By.css(`.${CSS_CLASS_DROPDOWNLISTITEM}`));
1784-
lastItem = items[items.length - 1].componentInstance;
1785-
(lastItem as IgxComboAddItemComponent).clicked(mockClick);
1786-
await wait(30);
1779+
await firstValueFrom(combo.virtualScrollContainer.chunkLoad);
1780+
const addItemButton = fixture.debugElement.query(By.directive(IgxComboAddItemComponent));
1781+
addItemButton.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
17871782
fixture.detectChanges();
17881783
// After `Add Item` is clicked, the input is focused and the item is added to the list
1789-
// expect(dropdown.focusedItem).toEqual(null);
1784+
expect(dropdown.focusedItem).toEqual(null);
17901785
expect(document.activeElement).toEqual(combo.searchInput.nativeElement);
17911786
expect(combo.customValueFlag).toBeFalsy();
17921787
expect(combo.searchInput.nativeElement.value).toBeTruthy();
17931788

17941789
// TEST move from first item
1795-
combo.virtualScrollContainer.scrollTo(0);
1796-
await wait();
1797-
fixture.detectChanges();
17981790
const firstItem = fixture.debugElement.queryAll(By.css(`.${CSS_CLASS_DROPDOWNLISTITEM}`))[0].componentInstance;
17991791
firstItem.clicked(mockClick);
1800-
await wait(30);
18011792
fixture.detectChanges();
18021793
expect(dropdown.focusedItem).toEqual(firstItem);
18031794
expect(dropdown.focusedItem.itemIndex).toEqual(0);
1804-
// spyOnProperty(dropdown, 'focusedItem', 'get').and.returnValue(firstItem);
18051795
dropdown.navigateFirst();
1806-
await wait(30);
18071796
fixture.detectChanges();
18081797
dropdown.navigatePrev();
1809-
await wait(30);
18101798
fixture.detectChanges();
1811-
// Called once before the `await` and called once more, because item @ index 0 is a header
1799+
// Called once manually and called once more, because item @ index 0 is a header
18121800
expect(virtualMockUP).toHaveBeenCalledTimes(2);
1801+
expect(dropdown.focusedItem).toBeNull();
18131802
}));
18141803
it('should properly get the first focusable item when focusing the component list', () => {
18151804
const expectedItemText = 'State: MichiganRegion: East North Central';

projects/igniteui-angular/src/lib/core/styles/components/tabs/_tabs-theme.scss

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,6 @@
252252
flex: 0 0 auto;
253253
background: var-get($theme, 'item-background');
254254
z-index: 1;
255-
256-
@if $indigo-theme {
257-
[igxIconButton='flat'].igx-button--focused {
258-
box-shadow: none;
259-
260-
&::after {
261-
border: rem(3px) solid var(--nav-btn-border-color);
262-
263-
@if $theme-variant == 'dark' {
264-
border-color: contrast-color($color: 'gray', $variant: 50, $opacity: .2);
265-
}
266-
}
267-
}
268-
}
269255
}
270256

271257
%tabs-header-content {

projects/igniteui-angular/src/lib/data-operations/filtering-expressions-tree.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ export declare interface IFilteringExpressionsTree extends IBaseEventArgs, IExpr
2020
/* alternateName: treeType */
2121
type?: FilteringExpressionsTreeType;
2222

23+
/* blazorSuppress */
2324
/**
2425
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.find` instead.
2526
*/
26-
find(fieldName: string): IFilteringExpressionsTree | IFilteringExpression;
27+
find?: (fieldName: string) => IFilteringExpressionsTree | IFilteringExpression;
2728

29+
/* blazorSuppress */
2830
/**
2931
* @deprecated in version 18.2.0. Use `ExpressionsTreeUtil.findIndex` instead.
3032
*/
31-
findIndex(fieldName: string): number;
33+
findIndex?: (fieldName: string) => number;
3234
}
3335

3436
/* marshalByValue */
@@ -112,6 +114,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
112114
return !expressionTree || !expressionTree.filteringOperands || !expressionTree.filteringOperands.length;
113115
}
114116

117+
/* blazorSuppress */
115118
/**
116119
* Returns the filtering expression for a column with the provided fieldName.
117120
* ```typescript
@@ -125,6 +128,7 @@ export class FilteringExpressionsTree implements IFilteringExpressionsTree {
125128
return ExpressionsTreeUtil.find(this, fieldName);
126129
}
127130

131+
/* blazorSuppress */
128132
/**
129133
* Returns the index of the filtering expression for a column with the provided fieldName.
130134
* ```typescript

projects/igniteui-angular/src/lib/directives/scroll-inertia/scroll_inertia.directive.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ export class IgxScrollInertiaDirective implements OnInit, OnDestroy {
6969
return;
7070
}
7171
const targetElem = this.parentElement;
72-
targetElem.addEventListener('wheel', this.onWheel.bind(this));
73-
targetElem.addEventListener('touchstart', this.onTouchStart.bind(this));
74-
targetElem.addEventListener('touchmove', this.onTouchMove.bind(this));
75-
targetElem.addEventListener('touchend', this.onTouchEnd.bind(this));
72+
targetElem.addEventListener('wheel', this.onWheel.bind(this), { passive: false });
73+
targetElem.addEventListener('touchstart', this.onTouchStart.bind(this), { passive: false });
74+
targetElem.addEventListener('touchmove', this.onTouchMove.bind(this), { passive: false });
75+
targetElem.addEventListener('touchend', this.onTouchEnd.bind(this), { passive: false });
7676
});
7777
}
7878

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-filtering.component.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
221221

222222
/**
223223
* Gets the minimum height.
224-
*
225-
* Setting value in template:
224+
*
225+
* Setting value in template:
226226
* ```ts
227-
* [minHeight]="'<number><unit (px|rem|etc..)>'"
227+
* [minHeight]="'<number><unit (px|rem|etc..)>'"
228228
* ```
229-
*
230-
* Example for setting a value:
229+
*
230+
* Example for setting a value:
231231
* ```ts
232232
* [minHeight]="'700px'"
233233
* ```
@@ -258,13 +258,13 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
258258

259259
/**
260260
* Gets the maximum height.
261-
*
262-
* Setting value in template:
261+
*
262+
* Setting value in template:
263263
* ```ts
264-
* [maxHeight]="'<number><unit (px|rem|etc..)>'"
264+
* [maxHeight]="'<number><unit (px|rem|etc..)>'"
265265
* ```
266-
*
267-
* Example for setting a value:
266+
*
267+
* Example for setting a value:
268268
* ```ts
269269
* [maxHeight]="'700px'"
270270
* ```
@@ -509,6 +509,11 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
509509
private renderValues() {
510510
this.filterValues = this.generateFilterValues();
511511
this.generateListData();
512+
this.expressionsList.forEach(expr => {
513+
if (this.column.dataType === GridColumnDataType.String && this.column.filteringIgnoreCase && expr.expression.searchVal) {
514+
this.modifyExpression(expr);
515+
}
516+
});
512517
}
513518

514519
private generateFilterValues() {
@@ -539,6 +544,16 @@ export class IgxGridExcelStyleFilteringComponent extends BaseFilteringComponent
539544
return filterValues;
540545
}
541546

547+
private modifyExpression(expr: ExpressionUI) {
548+
const lowerCaseFilterValues = new Set(Array.from(expr.expression.searchVal).map((value: string) => value.toLowerCase()));
549+
550+
this.grid.data.forEach(item => {
551+
if (lowerCaseFilterValues.has(item[this.column.field]?.toLowerCase())) {
552+
expr.expression.searchVal.add(item[this.column.field]);
553+
}
554+
});
555+
}
556+
542557
private generateListData() {
543558
this.listData = new Array<FilterListItem>();
544559
const shouldUpdateSelection = this.areExpressionsSelectable();

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5829,6 +5829,32 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
58295829
expect(gridCellValues).toEqual(listItems);
58305830
}));
58315831

5832+
it('Should filter grid correctly with case insensitive duplicates', fakeAsync(() => {
5833+
grid.data = SampleTestData.excelFilteringDataDuplicateValues();
5834+
fix.detectChanges();
5835+
// Open excel style custom filtering dialog.
5836+
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'AnotherField');
5837+
5838+
// Type string in search box.
5839+
const searchComponent = GridFunctions.getExcelStyleSearchComponent(fix);
5840+
const inputNativeElement = GridFunctions.getExcelStyleSearchComponentInput(fix, searchComponent);
5841+
UIInteractions.clickAndSendInputElementValue(inputNativeElement, 'cust', fix);
5842+
tick(100);
5843+
fix.detectChanges();
5844+
5845+
// Click 'apply' button to apply filter.
5846+
GridFunctions.clickApplyExcelStyleFiltering(fix);
5847+
tick(100);
5848+
fix.detectChanges();
5849+
5850+
// Get the results and verify their count.
5851+
const gridCellValues = GridFunctions.getColumnCells(fix, 'AnotherField')
5852+
.map(c => c.nativeElement.innerText)
5853+
.sort();
5854+
5855+
expect(gridCellValues.length).toEqual(5);
5856+
}));
5857+
58325858
it('Should disable the apply button when there are no results.', fakeAsync(() => {
58335859
GridFunctions.clickExcelFilterIconFromCode(fix, grid, 'Downloads');
58345860

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

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { GridFunctions } from '../../test-utils/grid-functions.spec';
1515
import { HierarchicalGridFunctions } from '../../test-utils/hierarchical-grid-functions.spec';
1616
import { IgxHierarchicalRowComponent } from './hierarchical-row.component';
1717
import { IgxHierarchicalGridDefaultComponent } from '../../test-utils/hierarchical-grid-components.spec';
18+
import { firstValueFrom } from 'rxjs';
1819

1920
describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
2021
let fixture;
@@ -101,7 +102,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
101102
fixture.detectChanges();
102103

103104
const childGrid = hierarchicalGrid.gridAPI.getChildGrids(false)[0] as IgxHierarchicalGridComponent;
104-
const childCell = childGrid.gridAPI.get_cell_by_index(0, 'ID');
105+
const childCell = childGrid.gridAPI.get_cell_by_index(0, 'ID');
105106
GridFunctions.focusCell(fixture, childCell);
106107
fixture.detectChanges();
107108

@@ -169,7 +170,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
169170
await wait(100);
170171
fixture.detectChanges();
171172
const startIndex = hierarchicalGrid.verticalScrollContainer.state.startIndex;
172-
const topOffset = GridFunctions.getGridDisplayContainer(fixture).nativeElement.style.top;
173+
const topOffset = GridFunctions.getGridDisplayContainer(fixture).nativeElement.style.top;
173174
const secondRow = hierarchicalGrid.dataRowList.toArray()[1];
174175
// expand second row
175176
(secondRow.nativeElement.children[0] as HTMLElement).click();
@@ -194,6 +195,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
194195
});
195196

196197
it('should not lose scroll position after expanding a row when there are already expanded rows above.', async () => {
198+
197199
// Expand two rows at the top
198200
(hierarchicalGrid.dataRowList.toArray()[2].nativeElement.children[0] as HTMLElement).click();
199201
await wait();
@@ -205,7 +207,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
205207

206208
// Scroll to bottom
207209
hierarchicalGrid.verticalScrollContainer.getScroll().scrollTop = 5000;
208-
await wait(50);
210+
await firstValueFrom(hierarchicalGrid.verticalScrollContainer.chunkLoad);
209211
fixture.detectChanges();
210212
// Expand two rows at the bottom
211213
(hierarchicalGrid.dataRowList.toArray()[6].nativeElement.children[0] as HTMLElement).click();
@@ -218,12 +220,12 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
218220

219221
// Scroll to top to make sure top.
220222
hierarchicalGrid.verticalScrollContainer.getScroll().scrollTop = 0;
221-
await wait();
223+
await firstValueFrom(hierarchicalGrid.verticalScrollContainer.chunkLoad);
222224
fixture.detectChanges();
223225

224226
// Scroll to somewhere in the middle and make sure scroll position stays when expanding/collapsing.
225227
hierarchicalGrid.verticalScrollContainer.getScroll().scrollTop = 1250;
226-
await wait();
228+
await firstValueFrom(hierarchicalGrid.verticalScrollContainer.chunkLoad);
227229
fixture.detectChanges();
228230
const startIndex = hierarchicalGrid.verticalScrollContainer.state.startIndex;
229231
const topOffset = GridFunctions.getGridDisplayContainer(fixture).nativeElement.style.top;
@@ -266,7 +268,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
266268
hierarchicalGrid.verticalScrollContainer.state.chunkSize).toBe(80);
267269
expect(hierarchicalGrid.verticalScrollContainer.getScroll().scrollTop)
268270
.toEqual(hierarchicalGrid.verticalScrollContainer.getScroll().scrollHeight -
269-
parseInt(hierarchicalGrid.verticalScrollContainer.igxForContainerSize, 10));
271+
parseInt(hierarchicalGrid.verticalScrollContainer.igxForContainerSize, 10));
270272
});
271273

272274
it('should update scroll height after expanding/collapsing rows.', async () => {
@@ -326,7 +328,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
326328
expect(scrHeight).toBe(3 * 51 + (childGrid1.nativeElement.closest('.igx-grid__tr-container') as HTMLElement).offsetHeight - 1);
327329
});
328330

329-
it('should update context information correctly for child grid container after scrolling', async () => {
331+
it('should update context information correctly for child grid container after scrolling', async () => {
330332
// expand 3rd row
331333
const row = hierarchicalGrid.dataRowList.toArray()[3];
332334
(row.nativeElement.children[0] as HTMLElement).click();
@@ -345,7 +347,7 @@ describe('IgxHierarchicalGrid Virtualization #hGrid', () => {
345347
expect(childRowComponent.index).toBe(4);
346348
});
347349

348-
it('should update scrollbar when expanding a row with data loaded after initial view initialization', (done) => {
350+
it('should update scrollbar when expanding a row with data loaded after initial view initialization', (done) => {
349351
fixture.componentInstance.data = fixture.componentInstance.generateData(10, 0);
350352
fixture.detectChanges();
351353

@@ -446,7 +448,7 @@ describe('IgxHierarchicalGrid Virtualization Custom Scenarios #hGrid', () => {
446448
});
447449
}));
448450

449-
it('should show scrollbar after expanding a row with data loaded after initial view initialization', async () => {
451+
it('should show scrollbar after expanding a row with data loaded after initial view initialization', async () => {
450452
const fixture = TestBed.createComponent(IgxHierarchicalGridNoScrollTestComponent);
451453
fixture.detectChanges();
452454
await wait();
@@ -505,12 +507,13 @@ export class IgxHierarchicalGridTestBaseComponent {
505507
let children;
506508
for (let i = 0; i < count; i++) {
507509
const rowID = parendID ? parendID + i : i.toString();
508-
if (level > 0 ) {
509-
children = this.generateData(count / 2 , currLevel - 1, rowID);
510-
}
511-
prods.push({
512-
ID: rowID, ChildLevels: currLevel, ProductName: 'Product: A' + i, Col1: i,
513-
Col2: i, Col3: i, childData: children, childData2: children });
510+
if (level > 0) {
511+
children = this.generateData(count / 2, currLevel - 1, rowID);
512+
}
513+
prods.push({
514+
ID: rowID, ChildLevels: currLevel, ProductName: 'Product: A' + i, Col1: i,
515+
Col2: i, Col3: i, childData: children, childData2: children
516+
});
514517
}
515518
return prods;
516519
}

0 commit comments

Comments
 (0)