Skip to content

Commit 630793a

Browse files
MKirovaMKirova
authored andcommitted
Update tests.
1 parent 9a54a80 commit 630793a

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('Pivot pipes', () => {
7272
it('transforms flat data to pivot data', () => {
7373
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
7474
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
75-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates);
75+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
7676
expect(rowStatePipeResult).toEqual([
7777
{ All: 2127, 'All-Bulgaria': 774, 'All-USA': 829, 'All-Uruguay': 524, AllCategory: 'All', AllCategory_level: 0 },
7878
{ ProductCategory: 'Clothing', All: 1526, 'All-Bulgaria': 774, 'All-USA': 296, 'All-Uruguay': 456, ProductCategory_level: 1 },
@@ -166,7 +166,7 @@ describe('Pivot pipes', () => {
166166
], level: 0
167167
}]);
168168
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
169-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates);
169+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
170170
expect(rowStatePipeResult).toEqual([
171171
{
172172
ProductCategory: 'Clothing', All: 1526, 'All-Bulgaria': 774, 'All-USA': 296,
@@ -183,7 +183,7 @@ describe('Pivot pipes', () => {
183183
expanded.set('All', false);
184184
const rowPipeResult = rowPipe.transform(data, pivotConfig, expanded);
185185
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
186-
const rowPipeCollapseResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expanded);
186+
const rowPipeCollapseResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expanded, true);
187187
expect(rowPipeCollapseResult).toEqual([
188188
{
189189
AllCategory: 'All',
@@ -196,7 +196,7 @@ describe('Pivot pipes', () => {
196196
]);
197197

198198
expanded.set('All', true);
199-
const rowPipeExpandResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expanded);
199+
const rowPipeExpandResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expanded, true);
200200
expect(rowPipeExpandResult).toEqual([
201201
{ AllCategory: 'All', All: 2127, 'All-Bulgaria': 774, 'All-USA': 829, 'All-Uruguay': 524, AllCategory_level: 0 },
202202
{ ProductCategory: 'Clothing', All: 1526, 'All-Bulgaria': 774, 'All-USA': 296, 'All-Uruguay': 456, ProductCategory_level: 1 },
@@ -219,7 +219,7 @@ describe('Pivot pipes', () => {
219219
];
220220
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
221221
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
222-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates);
222+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
223223
expect(rowStatePipeResult).toEqual([
224224
{ Date: '01/01/2021', ProductCategory: 'Clothing', All: 282, 'All-Bulgaria': 282, ProductCategory_level: 0, Date_level: 0 },
225225
{ Date: '01/05/2019', ProductCategory: 'Clothing', All: 296, 'All-USA': 296, ProductCategory_level: 0, Date_level: 0 },
@@ -251,7 +251,7 @@ describe('Pivot pipes', () => {
251251
}];
252252
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
253253
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
254-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates);
254+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
255255
expect(rowStatePipeResult).toEqual([
256256
{
257257
All: 2127, 'All-Bulgaria': 774, 'All-Uruguay': 524, 'All-USA': 829, AllDate: 'AllDate',
@@ -292,7 +292,7 @@ describe('Pivot pipes', () => {
292292
}];
293293
const rowPipeResult = rowPipe.transform(data, pivotConfig, new Map<any, boolean>());
294294
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, new Map<any, boolean>());
295-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>());
295+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>(), true);
296296
/* eslint-disable quote-props */
297297
expect(rowStatePipeResult).toEqual([
298298
{
@@ -325,7 +325,7 @@ describe('Pivot pipes', () => {
325325
}];
326326
const rowPipeResult = rowPipe.transform(data, pivotConfig, new Map<any, boolean>());
327327
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, new Map<any, boolean>());
328-
const rowStateResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>());
328+
const rowStateResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>(), true);
329329
/* eslint-disable quote-props */
330330
expect(rowStateResult).toEqual([
331331
{
@@ -368,7 +368,7 @@ describe('Pivot pipes', () => {
368368
];
369369
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
370370
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, expansionStates);
371-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>());
371+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>(), true);
372372
expect(rowStatePipeResult).toEqual([
373373
{
374374
'AllCategory': 'All', 'AllCategory_level': 0, 'All-UnitsSold': 2127,
@@ -411,7 +411,7 @@ describe('Pivot pipes', () => {
411411

412412
const rowPipeResult = rowPipe.transform(preprocessedData, pivotConfig, new Map<any, boolean>());
413413
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, new Map<any, boolean>());
414-
const rowStateResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>());
414+
const rowStateResult = rowStatePipe.transform(columnPipeResult, pivotConfig, new Map<any, boolean>(), true);
415415

416416
// same data but expanded
417417
expect(rowStateResult).toEqual(
@@ -705,7 +705,7 @@ describe('Pivot pipes', () => {
705705

706706
const rowPipeResult = rowPipe.transform(data, pivotConfig, expansionStates);
707707
const columnPipeResult = columnPipe.transform(rowPipeResult, pivotConfig, new Map<any, boolean>());
708-
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates);
708+
const rowStatePipeResult = rowStatePipe.transform(columnPipeResult, pivotConfig, expansionStates, true);
709709
expect(rowStatePipeResult.length).toEqual(44);
710710
expect(rowStatePipeResult[0]['AllPeriods']).toEqual('All Periods');
711711
expect(rowStatePipeResult[0]['AllProducts']).toEqual('All');

projects/igniteui-angular/src/lib/test-utils/pivot-grid-samples.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { IPivotConfiguration, PivotAggregation } from '../grids/pivot-grid/pivot
55

66
@Component({
77
template: `
8-
<igx-pivot-grid #grid [data]="data" [pivotConfiguration]="pivotConfigHierarchy">
8+
<igx-pivot-grid #grid [data]="data" [pivotConfiguration]="pivotConfigHierarchy" [defaultExpandState]='defaultExpand'>
99
</igx-pivot-grid>`
1010
})
1111
export class IgxPivotGridTestBaseComponent {
12+
public defaultExpand = true;
1213
@ViewChild('grid', { read: IgxPivotGridComponent, static: true }) public pivotGrid: IgxPivotGridComponent;
1314
public data;
1415

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div class="sample-column">
2-
<igx-pivot-grid #grid1 [data]="origData" [width]="'100%'" [height]="'100%'" [pivotConfiguration]="pivotConfigHierarchy">
2+
<igx-pivot-grid #grid1 [data]="origData" [width]="'100%'" [height]="'100%'" [defaultExpandState]='true' [pivotConfiguration]="pivotConfigHierarchy">
33
</igx-pivot-grid>
44
</div>

0 commit comments

Comments
 (0)