@@ -149,4 +149,39 @@ public async Task OnSelectedItemChanged_Ok()
149149 await cut . InvokeAsync ( ( ) => item . Click ( ) ) ;
150150 Assert . Null ( selectedItem ) ;
151151 }
152+
153+ [ Fact ]
154+ public void ShowPrefixIcon_Ok ( )
155+ {
156+ var items = new List < string ? > ( ) { null , "test1" , "test2" } ;
157+ var cut = Context . RenderComponent < Search < string ? > > ( pb =>
158+ {
159+ pb . Add ( a => a . ShowPrefixIcon , true ) ;
160+ } ) ;
161+ cut . Contains ( "search auto-complete search-prefix" ) ;
162+ cut . Contains ( "<div class=\" search-prefix-icon\" ><i class=\" fa-solid fa-magnifying-glass\" ></i></div>" ) ;
163+ }
164+
165+ [ Fact ]
166+ public void PrefixIconTemplate_Ok ( )
167+ {
168+ var items = new List < string ? > ( ) { null , "test1" , "test2" } ;
169+ var cut = Context . RenderComponent < Search < string ? > > ( pb =>
170+ {
171+ pb . Add ( a => a . ShowPrefixIcon , true ) ;
172+ pb . Add ( a => a . PrefixIconTemplate , b => b . AddContent ( 0 , "test-prefix-icon-template" ) ) ;
173+ } ) ;
174+ cut . Contains ( "<div class=\" search-prefix-icon\" >test-prefix-icon-template</div>" ) ;
175+ }
176+
177+ [ Fact ]
178+ public void ShowSearchButton_Ok ( )
179+ {
180+ var items = new List < string ? > ( ) { null , "test1" , "test2" } ;
181+ var cut = Context . RenderComponent < Search < string ? > > ( pb =>
182+ {
183+ pb . Add ( a => a . ShowSearchButton , false ) ;
184+ } ) ;
185+ cut . DoesNotContain ( "aria-label=\" Search\" " ) ;
186+ }
152187}
0 commit comments