File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed 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([email protected] ) Website: https://www.blazor.zone 5+
6+ namespace UnitTest . Components ;
7+
8+ public class NetworkMonitorIndicatorTest : BootstrapBlazorTestBase
9+ {
10+ [ Fact ]
11+ public async Task NetworkMonitorIndicator_Ok ( )
12+ {
13+ var cut = Context . RenderComponent < NetworkMonitorIndicator > ( pb =>
14+ {
15+ pb . Add ( a => a . PopoverPlacement , Placement . Top ) ;
16+ } ) ;
17+
18+ var com = cut . FindComponent < NetworkMonitor > ( ) ;
19+ await cut . InvokeAsync ( ( ) => com . Instance . TriggerNetworkStateChanged ( new NetworkMonitorState
20+ {
21+ IsOnline = true ,
22+ NetworkType = "4g" ,
23+ Downlink = 10.0 ,
24+ RTT = 50
25+ } ) ) ;
26+ Assert . DoesNotContain ( "offline" , cut . Markup ) ;
27+
28+ await cut . InvokeAsync ( ( ) => com . Instance . TriggerOnlineStateChanged ( false ) ) ;
29+ Assert . DoesNotContain ( "offline" , cut . Markup ) ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments