@@ -665,6 +665,52 @@ public async Task UseSearchForm_Ok()
665665 await cut . InvokeAsync ( ( ) => table . Instance . QueryAsync ( ) ) ;
666666 }
667667
668+ [ Fact ]
669+ public async Task SearchItems_Ok ( )
670+ {
671+ var localizer = Context . Services . GetRequiredService < IStringLocalizer < Foo > > ( ) ;
672+ var cut = Context . Render < BootstrapBlazorRoot > ( pb =>
673+ {
674+ pb . AddChildContent < Table < Foo > > ( pb =>
675+ {
676+ pb . Add ( a => a . RenderMode , TableRenderMode . Table ) ;
677+ pb . Add ( a => a . ShowToolbar , true ) ;
678+ pb . Add ( a => a . ShowSearch , true ) ;
679+ pb . Add ( a => a . UseSearchForm , true ) ;
680+ pb . Add ( a => a . SearchItems , new List < SearchItem > ( )
681+ {
682+ new SearchItem ( "Name" , typeof ( string ) , "名称" ) { MetaData = new StringSearchMetaData ( ) }
683+ } ) ;
684+ pb . Add ( a => a . SearchMode , SearchMode . Top ) ;
685+ pb . Add ( a => a . OnQueryAsync , OnQueryAsync ( localizer ) ) ;
686+ pb . Add ( a => a . TableColumns , foo => builder =>
687+ {
688+ builder . OpenComponent < TableColumn < Foo , string > > ( 0 ) ;
689+ builder . AddAttribute ( 1 , "Field" , "" ) ;
690+ builder . AddAttribute ( 2 , "FieldExpression" , Utility . GenerateValueExpression ( foo , "Name" , typeof ( string ) ) ) ;
691+ builder . CloseComponent ( ) ;
692+ } ) ;
693+ } ) ;
694+ } ) ;
695+
696+ cut . Contains ( "bb-editor bb-search-form" ) ;
697+
698+ // 触发 Filter
699+ var searchForm = cut . FindComponent < SearchForm > ( ) ;
700+ Assert . NotNull ( searchForm ) ;
701+
702+ var input = searchForm . FindComponent < BootstrapInput < string > > ( ) ;
703+ Assert . NotNull ( input ) ;
704+
705+ var cb = input . Instance . OnValueChanged ;
706+ Assert . NotNull ( cb ) ;
707+ await cb ( "test" ) ;
708+
709+ var table = cut . FindComponent < Table < Foo > > ( ) ;
710+ Assert . NotNull ( table ) ;
711+ await cut . InvokeAsync ( ( ) => table . Instance . QueryAsync ( ) ) ;
712+ }
713+
668714 [ Fact ]
669715 public void ShowToolbar_Ok ( )
670716 {
0 commit comments