@@ -7730,6 +7730,33 @@ public async Task GetValue_LookupServiceKey_NullText()
77307730 await cut . InvokeAsync ( ( ) => table . Instance . QueryAsync ( ) ) ;
77317731 cut . WaitForElement ( "[data-bs-original-title=\" True\" ]" ) ;
77327732 }
7733+
7734+ [ Fact ]
7735+ public async Task GetValue_LookupServiceKey_NullValue ( )
7736+ {
7737+ var localizer = Context . Services . GetRequiredService < IStringLocalizer < Foo > > ( ) ;
7738+ var cut = Context . RenderComponent < BootstrapBlazorRoot > ( pb =>
7739+ {
7740+ pb . AddChildContent < MockTable > ( pb =>
7741+ {
7742+ pb . Add ( a => a . OnQueryAsync , OnQueryAsync ( localizer ) ) ;
7743+ pb . Add ( a => a . TableColumns , foo => builder =>
7744+ {
7745+ builder . OpenComponent < TableColumn < Foo , bool > > ( 0 ) ;
7746+ builder . AddAttribute ( 1 , "Field" , true ) ;
7747+ builder . AddAttribute ( 2 , "FieldExpression" , Utility . GenerateValueExpression ( foo , "Complete" , typeof ( bool ) ) ) ;
7748+ builder . AddAttribute ( 3 , "LookupServiceKey" , "null-value" ) ;
7749+ builder . AddAttribute ( 4 , "LookupServiceData" , true ) ;
7750+ builder . AddAttribute ( 6 , "LookupService" , new MockLookupServiceAsync ( ) ) ;
7751+ builder . CloseComponent ( ) ;
7752+ } ) ;
7753+ } ) ;
7754+ } ) ;
7755+
7756+ var table = cut . FindComponent < MockTable > ( ) ;
7757+ await cut . InvokeAsync ( ( ) => table . Instance . QueryAsync ( ) ) ;
7758+ }
7759+
77337760 class MockLookupServiceAsync : LookupServiceBase
77347761 {
77357762 public override IEnumerable < SelectedItem > ? GetItemsByKey ( string ? key , object ? data ) => null ;
@@ -7762,6 +7789,15 @@ class MockLookupServiceAsync : LookupServiceBase
77627789 new ( "Fake-False" , "Fake-False" )
77637790 } ;
77647791 }
7792+
7793+ if ( key == "null-value" )
7794+ {
7795+ ret = new SelectedItem [ ]
7796+ {
7797+ new ( "True" , null ! ) ,
7798+ new ( "False" , null ! )
7799+ } ;
7800+ }
77657801 return ret ;
77667802 }
77677803 }
0 commit comments