File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the Apache 2.0 License
3+ // See the LICENSE file in the project root for more information.
4+ // Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
5+
6+ namespace UnitTest . Components ;
7+
8+ public class FilterProviderTest : BootstrapBlazorTestBase
9+ {
10+ [ Fact ]
11+ public async Task FilterProvider_Ok ( )
12+ {
13+ var cut = Context . RenderComponent < FilterProvider > ( pb =>
14+ {
15+ pb . Add ( a => a . ShowMoreButton , true ) ;
16+ pb . AddChildContent < MockFilter > ( ) ;
17+ } ) ;
18+
19+ var filter = cut . FindComponent < MockFilter > ( ) ;
20+ var context = filter . Instance . GetFilterContext ( ) ;
21+ Assert . NotNull ( context ) ;
22+ Assert . Equal ( 0 , context . Count ) ;
23+
24+ // 点击 +
25+ var plus = cut . Find ( ".card-footer button" ) ;
26+ await cut . InvokeAsync ( ( ) => plus . Click ( ) ) ;
27+ context = filter . Instance . GetFilterContext ( ) ;
28+ Assert . NotNull ( context ) ;
29+ Assert . Equal ( 1 , context . Count ) ;
30+ }
31+
32+ class MockFilter : StringFilter
33+ {
34+ public FilterContext ? GetFilterContext ( ) => FilterContext ;
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments