Skip to content

Commit 51237b8

Browse files
authored
Merge branch '8.2.x' into nrobakova/fix-issue-5837
2 parents 93e687d + d009ac6 commit 51237b8

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

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

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -960,8 +960,8 @@ describe('igxCombo', () => {
960960
// Combo selection is now based on valueKey:
961961
// if valueKey is specified, only the key will be written in the selection (not the whole data entry)
962962
const itemID = combo.valueKey !== null && combo.value !== undefined ?
963-
combo.data[itemIndex][combo.valueKey] :
964-
combo.data[itemIndex];
963+
combo.data[itemIndex][combo.valueKey] :
964+
combo.data[itemIndex];
965965
expect(combo.isItemSelected(itemID)).toBeTruthy();
966966
expect(combo.selectedItems()[selectedItemIndex]).toEqual(itemID);
967967
}
@@ -971,8 +971,8 @@ describe('igxCombo', () => {
971971
itemIndex: number) {
972972
const checkbox = getCheckbox(dropdownElement, itemIndex);
973973
const itemID = combo.valueKey !== null && combo.value !== undefined ?
974-
combo.data[itemIndex][combo.valueKey] :
975-
combo.data[itemIndex];
974+
combo.data[itemIndex][combo.valueKey] :
975+
combo.data[itemIndex];
976976
expect(checkbox.classList.contains(CSS_CLASS_CHECKED)).toBeFalsy();
977977
expect(combo.isItemSelected(itemID)).toBeFalsy();
978978
}
@@ -2286,6 +2286,37 @@ describe('igxCombo', () => {
22862286
}, 20);
22872287
}, 10);
22882288
});
2289+
2290+
it('Should bind combo data to remote data and clear selection properly', async (done) => {
2291+
const fixture = TestBed.createComponent(IgxComboRemoteDataComponent);
2292+
fixture.detectChanges();
2293+
const combo = fixture.componentInstance.instance;
2294+
let selectedItems = [combo.data[0], combo.data[1]];
2295+
const spyObj = jasmine.createSpyObj('event', ['stopPropagation']);
2296+
combo.toggle();
2297+
combo.selectItems([selectedItems[0][combo.valueKey], selectedItems[1][combo.valueKey]]);
2298+
expect(combo.value).toEqual(`${selectedItems[0][combo.displayKey]}, ${selectedItems[1][combo.displayKey]}`);
2299+
expect(combo.selectedItems()).toEqual([selectedItems[0][combo.valueKey], selectedItems[1][combo.valueKey]]);
2300+
// Clear items while they are in view
2301+
combo.handleClearItems(spyObj);
2302+
expect(combo.selectedItems()).toEqual([]);
2303+
expect(combo.value).toBe('');
2304+
selectedItems = [combo.data[2], combo.data[3]];
2305+
combo.selectItems([selectedItems[0][combo.valueKey], selectedItems[1][combo.valueKey]]);
2306+
expect(combo.value).toEqual(`${selectedItems[0][combo.displayKey]}, ${selectedItems[1][combo.displayKey]}`);
2307+
2308+
// Scroll selected items out of view
2309+
combo.virtualScrollContainer.scrollTo(40);
2310+
await wait(60);
2311+
fixture.detectChanges();
2312+
combo.handleClearItems(spyObj);
2313+
expect(combo.selectedItems()).toEqual([]);
2314+
expect(combo.value).toBe('');
2315+
combo.selectItems([combo.data[7][combo.valueKey]]);
2316+
expect(combo.value).toBe(combo.data[7][combo.displayKey]);
2317+
done();
2318+
});
2319+
22892320
it('Should render empty template when combo data source is not set', fakeAsync(() => {
22902321
const fixture = TestBed.createComponent(IgxComboEmptyTestComponent);
22912322
fixture.detectChanges();
@@ -3214,7 +3245,7 @@ describe('igxCombo', () => {
32143245
expect(fixture.componentInstance.comboSelectedItems).toEqual([...data].splice(1, 3));
32153246
}));
32163247

3217-
it('Should properly initialize when used in a Template form control', fakeAsync (() => {
3248+
it('Should properly initialize when used in a Template form control', fakeAsync(() => {
32183249
const fix = TestBed.createComponent(IgxComboInTemplatedFormComponent);
32193250
fix.detectChanges();
32203251
tick();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,14 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
11081108

11091109
/** Contains key-value pairs of the selected valueKeys and their resp. displayKeys */
11101110
private registerRemoteEntries(ids: any[], add = true) {
1111-
const selection = this.getValueDisplayPairs(ids);
11121111
if (add) {
1112+
const selection = this.getValueDisplayPairs(ids);
11131113
for (const entry of selection) {
11141114
this._remoteSelection[entry[this.valueKey]] = entry[this.displayKey];
11151115
}
11161116
} else {
1117-
for (const entry of selection) {
1118-
delete this._remoteSelection[entry[this.valueKey]];
1117+
for (const entry of ids) {
1118+
delete this._remoteSelection[entry];
11191119
}
11201120
}
11211121
}

projects/igniteui-angular/src/lib/core/styles/components/grid/_excel-filtering-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
/// @requires --var
1313
@mixin _excel-filtering($theme, $palette) {
1414
%grid-excel-filter {
15-
height: rem(15px);
1615
display: block;
1716
}
1817

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import {
1414
import {
1515
HorizontalAlignment,
1616
VerticalAlignment,
17-
ConnectedPositioningStrategy,
1817
OverlaySettings,
1918
IgxOverlayService,
20-
AbsoluteScrollStrategy
19+
AbsoluteScrollStrategy,
20+
AutoPositionStrategy
2121
} from '../../../services/index';
2222
import { IgxFilteringService, ExpressionUI } from '../grid-filtering.service';
2323
import {
@@ -114,7 +114,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy, OnInit, A
114114
private _subMenuOverlaySettings: OverlaySettings = {
115115
closeOnOutsideClick: true,
116116
modal: false,
117-
positionStrategy: new ConnectedPositioningStrategy(this._subMenuPositionSettings),
117+
positionStrategy: new AutoPositionStrategy(this._subMenuPositionSettings),
118118
scrollStrategy: new AbsoluteScrollStrategy()
119119
};
120120

0 commit comments

Comments
 (0)