|
1 | 1 | import { Component, ViewChild, TemplateRef, QueryList } from '@angular/core';
|
| 2 | +import { formatNumber } from '@angular/common' |
2 | 3 | import { fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
3 | 4 | import { By } from '@angular/platform-browser';
|
4 | 5 | import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
@@ -788,7 +789,7 @@ describe('IgxGrid - GroupBy #grid', () => {
|
788 | 789 | fix.detectChanges();
|
789 | 790 | grid.groupBy({
|
790 | 791 | fieldName: 'ReleaseDate', dir: SortingDirection.Asc, ignoreCase: false
|
791 |
| - }); |
| 792 | + }); |
792 | 793 | fix.detectChanges();
|
793 | 794 | spyOn(grid.groupingExpressionsChange, 'emit');
|
794 | 795 | fix.detectChanges();
|
@@ -1516,7 +1517,7 @@ describe('IgxGrid - GroupBy #grid', () => {
|
1516 | 1517 | expect(GridSelectionFunctions.verifyGroupByRowCheckboxState(grRow, true, false));
|
1517 | 1518 | }));
|
1518 | 1519 |
|
1519 |
| - it('the group row selector state should be indeterminated if some of the records in the group but not all are selected', |
| 1520 | + it('the group row selector state should be undetermined if some of the records in the group but not all are selected', |
1520 | 1521 | fakeAsync(() => {
|
1521 | 1522 | const fix = TestBed.createComponent(DefaultGridComponent);
|
1522 | 1523 | const grid = fix.componentInstance.instance;
|
@@ -2088,6 +2089,33 @@ describe('IgxGrid - GroupBy #grid', () => {
|
2088 | 2089 | expect(fix.componentInstance.onGroupByRowClick).toHaveBeenCalledWith(fix.componentInstance.groupByRowClick, contextUnselect);
|
2089 | 2090 | }));
|
2090 | 2091 |
|
| 2092 | + // GroupBy Row Formatting |
| 2093 | + it('should properly apply formatters, both custom and default ones for the default row value template', fakeAsync(() => { |
| 2094 | + const fix = TestBed.createComponent(GroupableGridComponent); |
| 2095 | + const grid = fix.componentInstance.instance; |
| 2096 | + tick(); |
| 2097 | + fix.detectChanges(); |
| 2098 | + grid.groupBy({ |
| 2099 | + fieldName: 'Downloads', dir: SortingDirection.Desc, ignoreCase: false |
| 2100 | + }); |
| 2101 | + tick(); |
| 2102 | + fix.detectChanges(); |
| 2103 | + let cellText = grid.groupsRowList.first.nativeElement.querySelector(".igx-group-label__text").innerText; |
| 2104 | + expect(cellText).toEqual(formatNumber(1000, grid.locale)); |
| 2105 | + // apply custom formatter |
| 2106 | + grid.getColumnByName('Downloads').formatter = (value, _row) => `\$${value}`; |
| 2107 | + grid.groupingExpressions = []; |
| 2108 | + tick(); |
| 2109 | + fix.detectChanges(); |
| 2110 | + grid.groupBy({ |
| 2111 | + fieldName: 'Downloads', dir: SortingDirection.Desc, ignoreCase: false |
| 2112 | + }); |
| 2113 | + tick(); |
| 2114 | + fix.detectChanges(); |
| 2115 | + cellText = grid.groupsRowList.first.nativeElement.querySelector(".igx-group-label__text").innerText; |
| 2116 | + expect(cellText).toEqual('$1000'); |
| 2117 | + })); |
| 2118 | + |
2091 | 2119 | // GroupBy + Resizing
|
2092 | 2120 | it('should retain same size for group row after a column is resized.', fakeAsync(() => {
|
2093 | 2121 | const fix = TestBed.createComponent(DefaultGridComponent);
|
@@ -3819,7 +3847,7 @@ export class CustomTemplateGridComponent extends DataParent {
|
3819 | 3847 | public width = '800px';
|
3820 | 3848 | public height = null;
|
3821 | 3849 |
|
3822 |
| - @ViewChild('template', {read: TemplateRef }) |
| 3850 | + @ViewChild('template', { read: TemplateRef }) |
3823 | 3851 | public customGroupBy: TemplateRef<any>;
|
3824 | 3852 | }
|
3825 | 3853 |
|
|
0 commit comments