@@ -3504,7 +3504,8 @@ describe('IgxGrid - Filtering actions - Excel style filtering', () => {
3504
3504
declarations : [
3505
3505
IgxGridFilteringComponent ,
3506
3506
IgxTestExcelFilteringDatePickerComponent ,
3507
- IgxGridFilteringESFTemplatesComponent
3507
+ IgxGridFilteringESFTemplatesComponent ,
3508
+ IgxGridFilteringMCHComponent
3508
3509
] ,
3509
3510
imports : [
3510
3511
NoopAnimationsModule ,
@@ -4258,6 +4259,42 @@ describe('IgxGrid - Filtering actions - Excel style filtering', () => {
4258
4259
tick ( 100 ) ;
4259
4260
} ) ) ;
4260
4261
4262
+ it ( 'Should filter, clear and enable/disable the apply button correctly.' , fakeAsync ( ( ) => {
4263
+ GridFunctions . clickExcelFilterIcon ( fix , 'ProductName' ) ;
4264
+ tick ( 100 ) ;
4265
+ fix . detectChanges ( ) ;
4266
+
4267
+ // Type string in search box.
4268
+ const searchComponent = GridFunctions . getExcelStyleSearchComponent ( fix ) ;
4269
+ const inputNativeElement = searchComponent . querySelector ( '.igx-input-group__input' ) ;
4270
+ sendInputNativeElement ( inputNativeElement , 'hello there' , fix ) ;
4271
+ tick ( 100 ) ;
4272
+ fix . detectChanges ( ) ;
4273
+
4274
+ // Verify there are no filtered-in results and that apply button is disabled.
4275
+ let listItems = searchComponent . querySelectorAll ( 'igx-list-item' ) ;
4276
+ let excelMenu = GridFunctions . getExcelStyleFilteringComponent ( fix ) ;
4277
+ let raisedButtons = Array . from ( excelMenu . querySelectorAll ( '.igx-button--raised' ) ) ;
4278
+ let applyButton : any = raisedButtons . find ( ( rb : any ) => rb . innerText === 'apply' ) ;
4279
+ expect ( listItems . length ) . toBe ( 0 , 'ESF search result should be empty' ) ;
4280
+ expect ( applyButton . classList . contains ( 'igx-button--disabled' ) ) . toBe ( true ) ;
4281
+
4282
+ // Clear filtering.
4283
+ const icons = Array . from ( searchComponent . querySelectorAll ( 'igx-icon' ) ) ;
4284
+ const clearIcon : any = icons . find ( ( ic : any ) => ic . innerText === 'clear' ) ;
4285
+ clearIcon . click ( ) ;
4286
+ tick ( 100 ) ;
4287
+ fix . detectChanges ( ) ;
4288
+
4289
+ // Verify there are filtered-in results and that apply button is enabled.
4290
+ listItems = searchComponent . querySelectorAll ( 'igx-list-item' ) ;
4291
+ excelMenu = GridFunctions . getExcelStyleFilteringComponent ( fix ) ;
4292
+ raisedButtons = Array . from ( excelMenu . querySelectorAll ( '.igx-button--raised' ) ) ;
4293
+ applyButton = raisedButtons . find ( ( rb : any ) => rb . innerText === 'apply' ) ;
4294
+ expect ( listItems . length ) . toBe ( 6 , 'ESF search result should NOT be empty' ) ;
4295
+ expect ( applyButton . classList . contains ( 'igx-button--disabled' ) ) . toBe ( false ) ;
4296
+ } ) ) ;
4297
+
4261
4298
it ( 'display density is properly applied on the excel style filtering component' , fakeAsync ( ( ) => {
4262
4299
const gridNativeElement = fix . debugElement . query ( By . css ( 'igx-grid' ) ) . nativeElement ;
4263
4300
const column = grid . columns . find ( ( c ) => c . field === 'ProductName' ) ;
@@ -5578,6 +5615,37 @@ describe('IgxGrid - Filtering actions - Excel style filtering', () => {
5578
5615
// expect(datePicker.componentInstance.templateDropDownTarget).toBeTruthy();
5579
5616
} ) ) ;
5580
5617
} ) ;
5618
+
5619
+ describe ( null , ( ) => {
5620
+ let fix , grid ;
5621
+ beforeEach ( fakeAsync ( ( ) => {
5622
+ fix = TestBed . createComponent ( IgxGridFilteringMCHComponent ) ;
5623
+ grid = fix . componentInstance . grid ;
5624
+ grid . filterMode = FilterMode . excelStyleFilter ;
5625
+ fix . detectChanges ( ) ;
5626
+ } ) ) ;
5627
+
5628
+ it ( 'Should not pin column when its parent group cannot be pinned.' , fakeAsync ( ( ) => {
5629
+ // Test prerequisites
5630
+ grid . width = '1000px' ;
5631
+ fix . detectChanges ( ) ;
5632
+ tick ( 100 ) ;
5633
+
5634
+ // Pin the 'AnotherField' column.
5635
+ GridFunctions . clickExcelFilterIcon ( fix , 'AnotherField' ) ;
5636
+ fix . detectChanges ( ) ;
5637
+ GridFunctions . clickPinIconInExcelStyleFiltering ( fix , false ) ;
5638
+ tick ( 200 ) ;
5639
+ fix . detectChanges ( ) ;
5640
+
5641
+ // Verify that the 'ProductName' pin button is disabled, because its parent column cannot be pinned.
5642
+ GridFunctions . clickExcelFilterIcon ( fix , 'ProductName' ) ;
5643
+ fix . detectChanges ( ) ;
5644
+ const pinButton = GridFunctions . getExcelFilteringPinContainer ( fix ) ;
5645
+ expect ( pinButton . classList . contains ( 'igx-excel-filter__actions-pin--disabled' ) ) . toBe ( true ,
5646
+ 'pinButton should be disabled' ) ;
5647
+ } ) ) ;
5648
+ } ) ;
5581
5649
} ) ;
5582
5650
5583
5651
const expectedResults = [ ] ;
0 commit comments