File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,31 @@ await cut.InvokeAsync(() => dialog.Show(new DialogOption()
3030 // 关闭弹窗
3131 var btn = cut . Find ( ".modal-header .btn-close" ) ;
3232 await cut . InvokeAsync ( ( ) => btn . Click ( ) ) ;
33+ }
3334
35+ [ Fact ]
36+ public async Task ShowToast_Ok ( )
37+ {
38+ var cut = Context . RenderComponent < BootstrapBlazorRoot > ( pb =>
39+ {
40+ pb . AddChildContent < ErrorComponent > ( ) ;
41+ } ) ;
42+ var errorButton = cut . Find ( ".btn-error" ) ;
43+ await cut . InvokeAsync ( ( ) => errorButton . Click ( ) ) ;
3444 cut . Contains ( "<div class=\" toast-body\" >test error logger</div>" ) ;
3545
3646 // 关闭 Toast
3747 var toast = cut . FindComponent < Toast > ( ) . Instance ;
3848 await cut . InvokeAsync ( ( ) => toast . Close ( ) ) ;
3949 cut . DoesNotContain ( "<div class=\" toast-body\" >test error logger</div>" ) ;
50+
51+ cut . SetParametersAndRender ( pb =>
52+ {
53+ pb . Add ( a => a . ShowToast , false ) ;
54+ } ) ;
55+ errorButton = cut . Find ( ".btn-error" ) ;
56+ await cut . InvokeAsync ( ( ) => errorButton . Click ( ) ) ;
57+ cut . DoesNotContain ( "<div class=\" toast-body\" >test error logger</div>" ) ;
4058 }
4159
4260 private class MockDialogTest : ComponentBase
You can’t perform that action at this time.
0 commit comments