@@ -2084,14 +2084,50 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
2084
2084
// iterate over unary conditions
2085
2085
// empty
2086
2086
GridFunctions . openFilterDDAndSelectCondition ( fix , 6 ) ;
2087
+ expect ( grid . filteringRow . expression . condition . name ) . toEqual ( 'empty' ) ;
2087
2088
2088
- grid . filteringRow . onClearClick ( ) ;
2089
+ const filterUIRow = fix . debugElement . query ( By . directive ( IgxGridFilteringRowComponent ) ) ;
2090
+ const reset = filterUIRow . queryAll ( By . css ( 'button' ) ) [ 0 ] ;
2091
+
2092
+ reset . triggerEventHandler ( 'click' , null ) ;
2089
2093
tick ( 100 ) ;
2090
2094
fix . detectChanges ( ) ;
2091
2095
2092
2096
expect ( grid . filteringRow . expression . condition . name ) . toEqual ( 'contains' ) ;
2093
2097
} ) ) ;
2094
2098
2099
+ it ( 'should reset expression to selected unary condition' , fakeAsync ( ( ) => {
2100
+ GridFunctions . clickFilterCellChip ( fix , 'ReleaseDate' ) ;
2101
+
2102
+ const filterUIRow = fix . debugElement . query ( By . directive ( IgxGridFilteringRowComponent ) ) ;
2103
+ const datePicker = filterUIRow . query ( By . directive ( IgxDatePickerComponent ) ) ;
2104
+
2105
+ // Equals condition
2106
+ datePicker . triggerEventHandler ( 'click' , null ) ;
2107
+ tick ( ) ;
2108
+ fix . detectChanges ( ) ;
2109
+
2110
+ const currentDay = document . querySelector ( '.igx-calendar__date--current' ) ;
2111
+
2112
+ currentDay . dispatchEvent ( new Event ( 'click' ) ) ;
2113
+ tick ( ) ;
2114
+ fix . detectChanges ( ) ;
2115
+
2116
+ expect ( grid . filteringRow . expression . condition . name ) . toEqual ( 'equals' ) ;
2117
+ expect ( grid . rowList . length ) . toEqual ( 1 ) ;
2118
+
2119
+ // This Month condition
2120
+ GridFunctions . openFilterDDAndSelectCondition ( fix , 6 ) ;
2121
+ tick ( ) ;
2122
+ fix . detectChanges ( ) ;
2123
+
2124
+ expect ( grid . filteringRow . expression . condition . name ) . toEqual ( 'thisMonth' ) ;
2125
+ expect ( grid . rowList . length ) . toEqual ( 3 ) ;
2126
+
2127
+ const conditionChips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
2128
+ expect ( conditionChips . length ) . toBe ( 1 ) ;
2129
+ } ) ) ;
2130
+
2095
2131
it ( 'Should filter by cells formatted data when using FormattedValuesFilteringStrategy' , fakeAsync ( ( ) => {
2096
2132
const formattedStrategy = new FormattedValuesFilteringStrategy ( [ 'Downloads' ] ) ;
2097
2133
grid . filterStrategy = formattedStrategy ;
0 commit comments