Skip to content

Commit 72e87c9

Browse files
committed
Merge branch 'master' of https://github.com/IgniteUI/igniteui-angular into update-typedoc-plugin
2 parents 8d30def + d55331a commit 72e87c9

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"web-animations-js": "^2.3.2"
8585
},
8686
"igxDevDependencies": {
87-
"@igniteui/angular-schematics": "~12.0.800-rc.0"
87+
"@igniteui/angular-schematics": "~12.0.800"
8888
},
8989
"ng-update": {
9090
"migrations": "./migrations/migration-collection.json"

projects/igniteui-angular/src/lib/grids/grid/grid.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
</div>
9797

9898
<div igxGridBody (keydown.control.c)="copyHandler($event)" (copy)="copyHandler($event)" class="igx-grid__tbody" role="rowgroup">
99-
<div class="igx-grid__tbody-content" tabindex="0" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
99+
<div class="igx-grid__tbody-content" tabindex="0" [attr.role]="dataView.length ? null : 'row'" (keydown)="navigation.handleNavigation($event)" (focus)="navigation.focusTbody($event)"
100100
(onDragStop)="selectionService.dragMode = $event" (scroll)='preventContainerScroll($event)'
101101
(onDragScroll)="dragScroll($event)" [igxGridDragSelect]="selectionService.dragMode"
102102
[style.height.px]='totalHeight' [style.width.px]='calcWidth || null' #tbody [attr.aria-activedescendant]="activeDescendant">
@@ -250,7 +250,7 @@
250250
</ng-template>
251251

252252
<ng-template #emptyFilteredGrid>
253-
<span class="igx-grid__tbody-message">
253+
<span class="igx-grid__tbody-message" role="cell">
254254
<span>{{emptyFilteredGridMessage}}</span>
255255
<span *ngIf='showAddButton'>
256256
<ng-container *ngTemplateOutlet='addRowEmptyTemplate || defaultAddRowEmptyTemplate'></ng-container>
@@ -259,7 +259,7 @@
259259
</ng-template>
260260

261261
<ng-template #defaultEmptyGrid>
262-
<span class="igx-grid__tbody-message">
262+
<span class="igx-grid__tbody-message" role="cell">
263263
<span>{{emptyGridMessage}}</span>
264264
<span *ngIf='showAddButton'>
265265
<ng-container *ngTemplateOutlet='addRowEmptyTemplate || defaultAddRowEmptyTemplate'></ng-container>

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,33 @@ describe('IgxGrid Component Tests #grid', () => {
271271
expect(summaryItemHeigh.offsetHeight).toBe(grid.defaultSummaryHeight - 1);
272272
}));
273273

274+
it ('checks if attributes are correctly assigned when grid has or does not have data', fakeAsync( () => {
275+
const fixture = TestBed.createComponent(IgxGridTestComponent);
276+
const grid = fixture.componentInstance.grid;
277+
278+
fixture.componentInstance.generateData(30);
279+
fixture.detectChanges();
280+
tick(100);
281+
// Checks if igx-grid__tbody-content attribute is null when there is data in the grid
282+
const container = fixture.nativeElement.querySelectorAll('.igx-grid__tbody-content')[0];
283+
expect(container.getAttribute('role')).toBe(null);
284+
285+
//Filter grid so no results are available and grid is empty
286+
grid.filter('index','111',IgxStringFilteringOperand.instance().condition('contains'),true);
287+
grid.markForCheck();
288+
fixture.detectChanges();
289+
expect(container.getAttribute('role')).toMatch('row');
290+
291+
// clear grid data and check if attribute is now 'row'
292+
grid.clearFilter();
293+
fixture.componentInstance.clearData();
294+
fixture.detectChanges();
295+
tick(100);
296+
297+
expect(container.getAttribute('role')).toMatch('row');
298+
299+
}));
300+
274301
it('should render empty message', fakeAsync(() => {
275302
const fixture = TestBed.createComponent(IgxGridTestComponent);
276303
fixture.componentInstance.data = [];

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,8 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
661661
* @param index
662662
*/
663663
public getRowByKey(key: any): RowType {
664-
const rec = this.primaryKey ? this.filteredSortedData.find(r => r[this.primaryKey] === key) :
665-
this.filteredSortedData.find(r => r === key);
664+
const rec = this.filteredSortedData ? this.primaryKey ? this.filteredSortedData.find(r => r[this.primaryKey] === key) :
665+
this.filteredSortedData.find(r => r === key) : undefined;
666666
const index = this.dataView.findIndex(r => r.data && r.data === rec);
667667
if (index < 0 || index >= this.filteredSortedData.length) {
668668
return undefined;

0 commit comments

Comments
 (0)