Skip to content

Commit 346c13d

Browse files
authored
Merge branch '9.0.x' into calendar-months-order-90x
2 parents dd9a8a9 + c0d647b commit 346c13d

File tree

9 files changed

+121
-78
lines changed

9 files changed

+121
-78
lines changed

projects/igniteui-angular/src/lib/directives/autocomplete/autocomplete.directive.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,14 @@ describe('IgxAutocomplete', () => {
366366
const verifyDropdownItems = function() {
367367
expect(dropdownListScrollElement.children.length).toEqual(filteredTowns.length);
368368
for (let itemIndex = 0; itemIndex < filteredTowns.length; itemIndex++) {
369-
expect(dropdownListScrollElement.children[itemIndex].nativeElement.textContent.trim()).
369+
const itemElement = dropdownListScrollElement.children[itemIndex].nativeElement;
370+
expect(itemElement.textContent.trim()).
370371
toEqual(filteredTowns[itemIndex]);
371372
const isFocused = itemIndex === 0 ? true : false;
372-
expect(dropdownListScrollElement.children[itemIndex].classes[CSS_CLASS_DROP_DOWN_ITEM_FOCUSED]).toEqual(isFocused);
373+
const hasFocusedClass =
374+
itemElement.classList.contains(CSS_CLASS_DROP_DOWN_ITEM_FOCUSED);
375+
isFocused ? expect(hasFocusedClass).toBeTruthy() :
376+
expect(hasFocusedClass).toBeFalsy();
373377
expect(dropDown.items[itemIndex].focused).toEqual(isFocused);
374378
}
375379
};

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -914,37 +914,37 @@ describe('IgxForOf directive -', () => {
914914
}).compileComponents();
915915
}));
916916

917-
it('should update display container classes when content state changes from virtualized to non-virtualzied.', () => {
917+
it('should update display container classes when content state changes from virtualized to non-virtualized.', () => {
918918
const fix = TestBed.createComponent(VirtualVariableSizeComponent);
919919
fix.detectChanges();
920920

921-
let displayContainerDebugEl: DebugElement[] = fix.debugElement.queryAll(By.css(DISPLAY_CONTAINER));
921+
let displayContainerDebugEl: DebugElement = fix.debugElement.query(By.css(DISPLAY_CONTAINER));
922922
// No size and no data - display container should be inactive
923-
expect(displayContainerDebugEl[0].classes[INACTIVE_VIRT_CONTAINER]).toBe(true);
923+
expect(displayContainerDebugEl.classes[INACTIVE_VIRT_CONTAINER]).toBeTruthy();
924924

925925
// set size
926926
fix.componentInstance.height = '500px';
927927
fix.detectChanges();
928928

929-
displayContainerDebugEl = fix.debugElement.queryAll(By.css(DISPLAY_CONTAINER));
929+
displayContainerDebugEl = fix.debugElement.query(By.css(DISPLAY_CONTAINER));
930930
// Has size but no data - display container should be inactive
931-
expect(displayContainerDebugEl[0].classes[INACTIVE_VIRT_CONTAINER]).toBe(true);
931+
expect(displayContainerDebugEl.classes[INACTIVE_VIRT_CONTAINER]).toBeTruthy();
932932

933933
// set data with 1 rec.
934934
fix.componentInstance.data = fix.componentInstance.generateData(1);
935935
fix.detectChanges();
936936

937-
displayContainerDebugEl = fix.debugElement.queryAll(By.css(DISPLAY_CONTAINER));
937+
displayContainerDebugEl = fix.debugElement.query(By.css(DISPLAY_CONTAINER));
938938
// Has size but not enough data to be virtualized - display container should be inactive
939-
expect(displayContainerDebugEl[0].classes[INACTIVE_VIRT_CONTAINER]).toBe(true);
939+
expect(displayContainerDebugEl.classes[INACTIVE_VIRT_CONTAINER]).toBeTruthy();
940940

941941
// set data with 1000 recs.
942942
fix.componentInstance.data = fix.componentInstance.generateData(1000);
943943
fix.detectChanges();
944944

945-
displayContainerDebugEl = fix.debugElement.queryAll(By.css(DISPLAY_CONTAINER));
945+
displayContainerDebugEl = fix.debugElement.query(By.css(DISPLAY_CONTAINER));
946946
// Has size and enough data to be virtualized - display container should be active.
947-
expect(displayContainerDebugEl[0].classes[INACTIVE_VIRT_CONTAINER]).toBe(false);
947+
expect(displayContainerDebugEl.classes[INACTIVE_VIRT_CONTAINER]).toBeFalsy();
948948
});
949949
});
950950

projects/igniteui-angular/src/lib/grids/grid/grid-mrl-keyboard-nav.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,9 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
12841284
{ field: 'ID', rowStart: 1, colStart: 1, rowEnd: 4 }
12851285
]
12861286
}];
1287+
fix.detectChanges();
1288+
12871289
const grid = fix.componentInstance.grid;
1288-
grid.height = '400px';
12891290
setupGridScrollDetection(fix, grid);
12901291
fix.detectChanges();
12911292

@@ -3119,7 +3120,7 @@ describe('IgxGrid Multi Row Layout - Keyboard navigation #grid', () => {
31193120

31203121
@Component({
31213122
template: `
3122-
<igx-grid #grid [data]="data" height="500px" (onSelection)="cellSelected($event)">
3123+
<igx-grid #grid [data]="data" [height]="'500px'" (onSelection)="cellSelected($event)">
31233124
<igx-column-layout *ngFor='let group of colGroups' [hidden]='group.hidden' [pinned]='group.pinned' [field]='group.group'>
31243125
<igx-column *ngFor='let col of group.columns'
31253126
[rowStart]="col.rowStart" [colStart]="col.colStart" [width]='col.width'

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

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { IgxStringFilteringOperand, IgxNumberFilteringOperand } from '../../data
2121
import { SortingDirection, ISortingExpression } from '../../data-operations/sorting-expression.interface';
2222
import { configureTestSuite } from '../../test-utils/configure-suite';
2323
import { IgxTabsModule, IgxTabsComponent } from '../../tabs';
24-
import { resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
2524
import { GridSelectionMode } from '../common/enums';
2625

2726

@@ -979,7 +978,7 @@ describe('IgxGrid Component Tests #grid', () => {
979978
fix.componentInstance.data = fix.componentInstance.fullData;
980979
fix.detectChanges();
981980
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
982-
expect(defaultHeight).not.toBeNull();
981+
expect(defaultHeight).not.toBeFalsy();
983982
expect(parseInt(defaultHeight, 10)).toBeGreaterThan(400);
984983
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBeTruthy();
985984
expect(fix.componentInstance.grid.rowList.length).toBeGreaterThanOrEqual(10);
@@ -993,7 +992,7 @@ describe('IgxGrid Component Tests #grid', () => {
993992
fix.detectChanges();
994993

995994
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
996-
expect(defaultHeight).not.toBeNull();
995+
expect(defaultHeight).not.toBeFalsy();
997996
expect(parseInt(defaultHeight, 10)).toBeGreaterThan(400);
998997
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBeTruthy();
999998
expect(fix.componentInstance.grid.rowList.length).toBeGreaterThanOrEqual(10);
@@ -1007,7 +1006,7 @@ describe('IgxGrid Component Tests #grid', () => {
10071006
fix.detectChanges();
10081007
tick(16);
10091008
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1010-
expect(defaultHeight).toBeNull();
1009+
expect(defaultHeight).toBeFalsy();
10111010
expect(fix.debugElement.query(By.css(TBODY_CLASS))
10121011
.nativeElement.getBoundingClientRect().height).toBeGreaterThan(200);
10131012
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBeFalsy();
@@ -1030,7 +1029,7 @@ describe('IgxGrid Component Tests #grid', () => {
10301029

10311030
const defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
10321031
const defaultHeightNum = parseInt(defaultHeight, 10);
1033-
expect(defaultHeight).not.toBeNull();
1032+
expect(defaultHeight).not.toBeFalsy();
10341033
expect(defaultHeightNum).toBe(330);
10351034
expect(fix.componentInstance.isVerticalScrollbarVisible()).toBeTruthy();
10361035
expect(fix.componentInstance.grid.rowList.length).toEqual(11);
@@ -1066,14 +1065,14 @@ describe('IgxGrid Component Tests #grid', () => {
10661065
tick();
10671066
fix.detectChanges();
10681067
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1069-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1068+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
10701069
expect(fix.componentInstance.grid.calcHeight).toBeNull();
10711070
fix.componentInstance.data = fix.componentInstance.fullData;
10721071
tick();
10731072
fix.detectChanges();
10741073
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
10751074
const defaultHeightNum = parseInt(defaultHeight, 10);
1076-
expect(defaultHeight).not.toBeNull();
1075+
expect(defaultHeight).not.toBeFalsy();
10771076
expect(defaultHeightNum).toBe(510);
10781077
expect(fix.componentInstance.grid.calcHeight).toBe(510);
10791078
}));
@@ -1083,15 +1082,15 @@ describe('IgxGrid Component Tests #grid', () => {
10831082
fix.detectChanges();
10841083

10851084
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1086-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1085+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
10871086
expect(fix.componentInstance.grid.calcHeight).toBeNull();
10881087

10891088
fix.componentInstance.data = fix.componentInstance.fullData;
10901089
fix.detectChanges();
10911090

10921091
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
10931092
const defaultHeightNum = parseInt(defaultHeight, 10);
1094-
expect(defaultHeight).not.toBeNull();
1093+
expect(defaultHeight).not.toBeFalsy();
10951094
expect(defaultHeightNum).toBe(510);
10961095
expect(fix.componentInstance.grid.calcHeight).toBe(510);
10971096
}));
@@ -1102,15 +1101,15 @@ describe('IgxGrid Component Tests #grid', () => {
11021101
fix.detectChanges();
11031102

11041103
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1105-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1104+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
11061105
expect(fix.componentInstance.grid.calcHeight).toBeNull();
11071106

11081107
fix.componentInstance.data = Array.from({ length: 100000 }, (_, i) => ({ 'ID': i, 'CompanyName': 'CN' + i }));
11091108
fix.detectChanges();
11101109

11111110
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11121111
const defaultHeightNum = parseInt(defaultHeight, 10);
1113-
expect(defaultHeight).not.toBeNull();
1112+
expect(defaultHeight).not.toBeFalsy();
11141113
expect(defaultHeightNum).toBe(510);
11151114
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11161115
});
@@ -1121,14 +1120,15 @@ describe('IgxGrid Component Tests #grid', () => {
11211120
fix.detectChanges();
11221121

11231122
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1124-
expect(defaultHeight).toBeNull();
1123+
expect(defaultHeight).toBeFalsy();
11251124
expect(fix.componentInstance.grid.calcHeight).toBeNull();
11261125
fix.componentInstance.data = fix.componentInstance.fullData;
1126+
fix.componentInstance.cdr.detectChanges();
11271127
fix.detectChanges();
11281128

11291129
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11301130
const defaultHeightNum = parseInt(defaultHeight, 10);
1131-
expect(defaultHeight).not.toBeNull();
1131+
expect(defaultHeight).not.toBeFalsy();
11321132
expect(defaultHeightNum).toBe(510);
11331133
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11341134
});
@@ -1139,14 +1139,14 @@ describe('IgxGrid Component Tests #grid', () => {
11391139
fix.componentInstance.data = fix.componentInstance.semiData;
11401140
fix.detectChanges();
11411141
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1142-
expect(defaultHeight).toBeNull();
1142+
expect(defaultHeight).toBeFalsy();
11431143
expect(fix.componentInstance.grid.calcHeight).toBeNull();
11441144
fix.componentInstance.data = Array.from({ length: 100000 }, (_, i) => ({ 'ID': i, 'CompanyName': 'CN' + i }));
11451145
fix.detectChanges();
11461146
await wait(500);
11471147
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11481148
const defaultHeightNum = parseInt(defaultHeight, 10);
1149-
expect(defaultHeight).not.toBeNull();
1149+
expect(defaultHeight).not.toBeFalsy();
11501150
expect(defaultHeightNum).toBe(510);
11511151
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11521152
});
@@ -1156,22 +1156,22 @@ describe('IgxGrid Component Tests #grid', () => {
11561156
tick();
11571157
fix.detectChanges();
11581158
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1159-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1159+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
11601160
expect(fix.componentInstance.grid.calcHeight).toBeNull();
11611161
fix.componentInstance.data = fix.componentInstance.fullData;
11621162
tick();
11631163
fix.detectChanges();
11641164
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11651165
let defaultHeightNum = parseInt(defaultHeight, 10);
1166-
expect(defaultHeight).not.toBeNull();
1166+
expect(defaultHeight).not.toBeFalsy();
11671167
expect(defaultHeightNum).toBe(510);
11681168
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11691169
fix.componentInstance.grid.filter('ID', 'ALFKI', IgxStringFilteringOperand.instance().condition('equals'));
11701170
tick();
11711171
fix.detectChanges();
11721172
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11731173
defaultHeightNum = parseInt(defaultHeight, 10);
1174-
expect(defaultHeight).not.toBeNull();
1174+
expect(defaultHeight).not.toBeFalsy();
11751175
expect(defaultHeightNum).toBe(510);
11761176
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11771177
}));
@@ -1181,15 +1181,15 @@ describe('IgxGrid Component Tests #grid', () => {
11811181
fix.detectChanges();
11821182

11831183
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1184-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1184+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
11851185
expect(fix.componentInstance.grid.calcHeight).toBeNull();
11861186

11871187
fix.componentInstance.data = fix.componentInstance.fullData;
11881188
fix.detectChanges();
11891189

11901190
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
11911191
const defaultHeightNum = parseInt(defaultHeight, 10);
1192-
expect(defaultHeight).not.toBeNull();
1192+
expect(defaultHeight).not.toBeFalsy();
11931193
expect(defaultHeightNum).toBe(510);
11941194
expect(fix.componentInstance.grid.calcHeight).toBe(510);
11951195

@@ -1199,7 +1199,7 @@ describe('IgxGrid Component Tests #grid', () => {
11991199
fix.detectChanges();
12001200

12011201
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1202-
expect(defaultHeight).toBeNull();
1202+
expect(defaultHeight).toBeFalsy();
12031203
expect(fix.componentInstance.grid.calcHeight).toBeNull();
12041204
});
12051205

@@ -1208,15 +1208,15 @@ describe('IgxGrid Component Tests #grid', () => {
12081208
fix.detectChanges();
12091209

12101210
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
1211-
expect(defaultHeight).toBeNull(); // initially body height is null in auto-sizing scenarios with empty data
1211+
expect(defaultHeight).toBeFalsy(); // initially body height is null in auto-sizing scenarios with empty data
12121212
expect(fix.componentInstance.grid.calcHeight).toBeNull();
12131213

12141214
fix.componentInstance.data = fix.componentInstance.fullData;
12151215
fix.detectChanges();
12161216

12171217
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
12181218
let defaultHeightNum = parseInt(defaultHeight, 10);
1219-
expect(defaultHeight).not.toBeNull();
1219+
expect(defaultHeight).not.toBeFalsy();
12201220
expect(defaultHeightNum).toBe(510);
12211221
expect(fix.componentInstance.grid.calcHeight).toBe(510);
12221222

@@ -1225,7 +1225,7 @@ describe('IgxGrid Component Tests #grid', () => {
12251225

12261226
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
12271227
defaultHeightNum = parseInt(defaultHeight, 10);
1228-
expect(defaultHeight).not.toBeNull();
1228+
expect(defaultHeight).not.toBeFalsy();
12291229
expect(defaultHeightNum).toBeLessThan(400);
12301230
expect(defaultHeightNum).toBeGreaterThan(300);
12311231
expect(fix.componentInstance.grid.calcHeight).toBeLessThan(400);
@@ -1239,7 +1239,7 @@ describe('IgxGrid Component Tests #grid', () => {
12391239
fix.detectChanges();
12401240
let defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
12411241
let defaultHeightNum = parseInt(defaultHeight, 10);
1242-
expect(defaultHeight).not.toBeNull();
1242+
expect(defaultHeight).not.toBeFalsy();
12431243
expect(defaultHeightNum).toBeLessThan(800);
12441244
expect(defaultHeightNum).toBeGreaterThan(700);
12451245
expect(fix.componentInstance.grid.calcHeight).toBeLessThan(800);
@@ -1249,7 +1249,7 @@ describe('IgxGrid Component Tests #grid', () => {
12491249
fix.detectChanges();
12501250
defaultHeight = fix.debugElement.query(By.css(TBODY_CLASS)).styles.height;
12511251
defaultHeightNum = parseInt(defaultHeight, 10);
1252-
expect(defaultHeight).not.toBeNull();
1252+
expect(defaultHeight).not.toBeFalsy();
12531253
expect(defaultHeightNum).toBeLessThan(800);
12541254
expect(defaultHeightNum).toBeGreaterThan(700);
12551255
expect(fix.componentInstance.grid.calcHeight).toBeLessThan(800);
@@ -1960,6 +1960,8 @@ export class IgxGridTestComponent {
19601960

19611961
public columnEventCount = 0;
19621962

1963+
constructor(public cdr: ChangeDetectorRef) { }
1964+
19631965
public columnCreated(column: IgxColumnComponent) {
19641966
this.columnEventCount++;
19651967
column.filterable = true;

projects/igniteui-angular/src/lib/grids/grid/grid.master-detail.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,9 @@ describe('IgxGrid Master Detail #grid', () => {
807807
fix.detectChanges();
808808
const row = grid.getRowByKey('ALFKI');
809809
expect(row).toBeUndefined();
810-
detailViews = fix.debugElement.queryAll(By.css('div[detail="true"]'));
811-
expect(detailViews[0].context.index).toBe(3);
810+
detailViews = fix.debugElement.queryAll(By.css('div[detail="true"]')).sort((a, b) => a.context.index - b.context.index);
811+
expect(detailViews[0].context.index).toBe(1);
812+
expect(detailViews[0].context.templateID).toBe('detailRow-ANATR');
812813
});
813814

814815
it('Should be able to expand detail view of newly added row.', async() => {

0 commit comments

Comments
 (0)