@@ -7,7 +7,6 @@ import { Column, FilterArguments, GridOption } from '../../models';
77import { CollectionService } from '../../services/collection.service' ;
88import { Filters } from '..' ;
99import { SingleSelectFilter } from '../singleSelectFilter' ;
10- import { of , Subject } from 'rxjs' ;
1110
1211const containerId = 'demo-container' ;
1312
@@ -30,7 +29,7 @@ describe('SingleSelectFilter', () => {
3029 let divContainer : HTMLDivElement ;
3130 let filter : SingleSelectFilter ;
3231 let filterArguments : FilterArguments ;
33- let spyGetHeaderRow ;
32+ let spyGetHeaderRow : any ;
3433 let mockColumn : Column ;
3534 let collectionService : CollectionService ;
3635 let translate : TranslateService ;
@@ -81,21 +80,22 @@ describe('SingleSelectFilter', () => {
8180 } ) ;
8281
8382 it ( 'should be a single-select filter' , ( ) => {
84- mockColumn . filter . collection = [ { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
83+ mockColumn . filter ! . collection = [ { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
8584 filter = new SingleSelectFilter ( translate , collectionService ) ;
86- filter . init ( filterArguments , true ) ;
85+ filter . init ( filterArguments ) ;
8786 const filterCount = divContainer . querySelectorAll ( 'select.ms-filter.search-filter.filter-gender' ) . length ;
8887
8988 expect ( spyGetHeaderRow ) . toHaveBeenCalled ( ) ;
9089 expect ( filterCount ) . toBe ( 1 ) ;
9190 expect ( filter . isMultipleSelect ) . toBe ( false ) ;
91+ expect ( filter . columnDef . filter ! . emptySearchTermReturnAllValues ) . toBeUndefined ( ) ;
9292 } ) ;
9393
9494 it ( 'should create the select filter with empty search term when passed an empty string as a filter argument and not expect "filled" css class either' , ( ) => {
95- mockColumn . filter . collection = [ { value : '' , label : '' } , { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
95+ mockColumn . filter ! . collection = [ { value : '' , label : '' } , { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
9696
9797 filterArguments . searchTerms = [ '' ] ;
98- filter . init ( filterArguments , true ) ;
98+ filter . init ( filterArguments ) ;
9999 const filterListElm = divContainer . querySelectorAll < HTMLInputElement > ( `[name=filter-gender].ms-drop ul>li input[type=radio]` ) ;
100100
101101 const filterFilledElms = divContainer . querySelectorAll < HTMLDivElement > ( '.ms-parent.ms-filter.search-filter.filter-gender.filled' ) ;
@@ -105,10 +105,10 @@ describe('SingleSelectFilter', () => {
105105
106106 it ( 'should trigger single select change event and expect the callback to be called when we select a single search term from dropdown list' , ( ) => {
107107 const spyCallback = jest . spyOn ( filterArguments , 'callback' ) ;
108- mockColumn . filter . collection = [ { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
108+ mockColumn . filter ! . collection = [ { value : 'male' , label : 'male' } , { value : 'female' , label : 'female' } ] ;
109109
110- filter . init ( filterArguments , true ) ;
111- const filterBtnElm = divContainer . querySelector < HTMLButtonElement > ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) ;
110+ filter . init ( filterArguments ) ;
111+ const filterBtnElm = divContainer . querySelector ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) as HTMLButtonElement ;
112112 const filterListElm = divContainer . querySelectorAll < HTMLInputElement > ( `[name=filter-gender].ms-drop ul>li input[type=radio]` ) ;
113113 filterBtnElm . click ( ) ;
114114
@@ -134,10 +134,10 @@ describe('SingleSelectFilter', () => {
134134 } ;
135135
136136 filterArguments . searchTerms = [ 'male' , 'female' ] ;
137- filter . init ( filterArguments , true ) ;
137+ filter . init ( filterArguments ) ;
138138
139139 setTimeout ( ( ) => {
140- const filterBtnElm = divContainer . querySelector < HTMLButtonElement > ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) ;
140+ const filterBtnElm = divContainer . querySelector ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) as HTMLButtonElement ;
141141 const filterListElm = divContainer . querySelectorAll < HTMLSpanElement > ( `[name=filter-gender].ms-drop ul>li span` ) ;
142142 const filterOkElm = divContainer . querySelectorAll < HTMLButtonElement > ( `[name=filter-gender].ms-drop .ms-ok-button` ) ;
143143 const filterSelectAllElm = divContainer . querySelectorAll < HTMLSpanElement > ( '.filter-gender .ms-select-all label span' ) ;
@@ -167,9 +167,9 @@ describe('SingleSelectFilter', () => {
167167 } ;
168168
169169 filterArguments . searchTerms = [ 'male' , 'female' ] ;
170- filter . init ( filterArguments , true ) ;
170+ filter . init ( filterArguments ) ;
171171 setTimeout ( ( ) => {
172- const filterBtnElm = divContainer . querySelector < HTMLButtonElement > ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) ;
172+ const filterBtnElm = divContainer . querySelector ( '.ms-parent.ms-filter.search-filter.filter-gender button.ms-choice' ) as HTMLButtonElement ;
173173 const filterListElm = divContainer . querySelectorAll < HTMLSpanElement > ( `[name=filter-gender].ms-drop ul>li span` ) ;
174174 filterBtnElm . click ( ) ;
175175
0 commit comments