@@ -86,6 +86,14 @@ public async Task OnCustomFilter_Ok()
8686 } ) ;
8787 await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
8888 Assert . True ( filtered ) ;
89+
90+ cut . SetParametersAndRender ( pb =>
91+ {
92+ pb . Add ( pb => pb . OnCustomFilter , null ! ) ;
93+ } ) ;
94+ await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "" ) ) ;
95+ var items = cut . FindAll ( ".dropdown-item" ) ;
96+ Assert . Equal ( 2 , items . Count ) ;
8997 }
9098
9199 [ Fact ]
@@ -188,7 +196,7 @@ public async Task IgnoreCase_Ok()
188196 {
189197 builder . Add ( a => a . Items , items ) ;
190198 builder . Add ( a => a . IgnoreCase , true ) ;
191- builder . Add ( a => a . OnGetDisplayText , foo => foo . Name ) ;
199+ builder . Add ( a => a . OnGetDisplayText , foo => foo ? . Name ) ;
192200 } ) ;
193201
194202 await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
@@ -221,7 +229,7 @@ public async Task IsLikeMatch_Ok()
221229 {
222230 builder . Add ( a => a . Items , items ) ;
223231 builder . Add ( a => a . IsLikeMatch , false ) ;
224- builder . Add ( a => a . OnGetDisplayText , foo => foo . Name ) ;
232+ builder . Add ( a => a . OnGetDisplayText , foo => foo ? . Name ) ;
225233 } ) ;
226234
227235 await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
@@ -244,6 +252,42 @@ public async Task IsLikeMatch_Ok()
244252 await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "a" ) ) ;
245253 menus = cut . FindAll ( ".dropdown-item" ) ;
246254 Assert . Equal ( 4 , menus . Count ) ;
255+
256+ cut . SetParametersAndRender ( pb =>
257+ {
258+ pb . Add ( a => a . OnGetDisplayText , null ) ;
259+ pb . Add ( a => a . IsLikeMatch , false ) ;
260+ } ) ;
261+ await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
262+ menus = cut . FindAll ( ".dropdown-item" ) ;
263+ Assert . Single ( menus ) ;
264+
265+ cut . SetParametersAndRender ( pb =>
266+ {
267+ pb . Add ( a => a . OnGetDisplayText , null ) ;
268+ pb . Add ( a => a . IsLikeMatch , true ) ;
269+ } ) ;
270+ await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
271+ menus = cut . FindAll ( ".dropdown-item" ) ;
272+ Assert . Single ( menus ) ;
273+
274+ cut . SetParametersAndRender ( pb =>
275+ {
276+ pb . Add ( a => a . OnGetDisplayText , foo => null ) ;
277+ pb . Add ( a => a . IsLikeMatch , false ) ;
278+ } ) ;
279+ await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
280+ menus = cut . FindAll ( ".dropdown-item" ) ;
281+ Assert . Single ( menus ) ;
282+
283+ cut . SetParametersAndRender ( pb =>
284+ {
285+ pb . Add ( a => a . OnGetDisplayText , foo => null ) ;
286+ pb . Add ( a => a . IsLikeMatch , true ) ;
287+ } ) ;
288+ await cut . InvokeAsync ( ( ) => cut . Instance . TriggerFilter ( "t" ) ) ;
289+ menus = cut . FindAll ( ".dropdown-item" ) ;
290+ Assert . Single ( menus ) ;
247291 }
248292
249293 [ Fact ]
0 commit comments