Skip to content

Commit a367614

Browse files
gedinakovaOtixa
authored andcommitted
test(*): Adding a test for binding the tree to a deserialized object.
1 parent 1a7065e commit a367614

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
IgxGridAdvancedFilteringComponent,
1616
IgxGridExternalAdvancedFilteringComponent,
1717
IgxGridAdvancedFilteringBindingComponent,
18-
IgxGridAdvancedFilteringDynamicColumnsComponent
18+
IgxGridAdvancedFilteringDynamicColumnsComponent,
19+
IgxGridAdvancedFilteringSerializedTreeComponent
1920
} from '../../test-utils/grid-samples.spec';
2021
import { FormattedValuesFilteringStrategy } from '../../data-operations/filtering-strategy';
2122
import { IgxHierGridExternalAdvancedFilteringComponent } from '../../test-utils/hierarchical-grid-components.spec';

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,53 @@ export class IgxGridAdvancedFilteringBindingComponent extends BasicGridComponent
20772077
}
20782078
}
20792079

2080+
@Component({
2081+
template: `
2082+
<igx-grid [data]="data" height="500px" [allowAdvancedFiltering]="true" [(advancedFilteringExpressionsTree)]="filterTree">
2083+
<igx-column width="100px" [field]="'ID'" [header]="'ID'" [hasSummary]="true" [filterable]="false" [resizable]="resizable">
2084+
</igx-column>
2085+
<igx-column width="100px" [field]="'ProductName'" [filterable]="filterable" [resizable]="resizable" dataType="string"></igx-column>
2086+
<igx-column width="100px" [field]="'Downloads'" [filterable]="filterable" [resizable]="resizable" dataType="number"></igx-column>
2087+
<igx-column width="100px" [field]="'Released'" [filterable]="filterable" [resizable]="resizable" dataType="boolean"></igx-column>
2088+
</igx-grid>`,
2089+
imports: [IgxGridComponent, IgxColumnComponent]
2090+
})
2091+
export class IgxGridAdvancedFilteringSerializedTreeComponent extends BasicGridComponent implements OnInit {
2092+
public resizable = false;
2093+
public filterable = true;
2094+
public filterTree: IFilteringExpressionsTree;
2095+
2096+
public override data = SampleTestData.excelFilteringData();
2097+
2098+
public ngOnInit(): void {
2099+
this.filterTree = JSON.parse(`{
2100+
"filteringOperands": [
2101+
{
2102+
"conditionName": "greaterThan",
2103+
"fieldName": "Downloads",
2104+
"searchVal": 200
2105+
}
2106+
],
2107+
"operator": 0
2108+
}`);
2109+
// this.filterTree = JSON.parse(`{
2110+
// "filteringOperands": [
2111+
// {
2112+
// "conditionName": "greaterThan",
2113+
// "condition":{
2114+
// "name":"greaterThan",
2115+
// "isUnary":false,
2116+
// "iconName":"filter_greater_than"
2117+
// },
2118+
// "fieldName": "Downloads",
2119+
// "searchVal": 200
2120+
// }
2121+
// ],
2122+
// "operator": 0
2123+
// }`);
2124+
}
2125+
}
2126+
20802127
@Component({
20812128
template: `
20822129
<igx-grid [data]="data" width="300px" height="250px">

0 commit comments

Comments
 (0)