File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -673,6 +673,23 @@ public void CollapseBarTemplate_Ok()
673673 Assert . Contains ( "CollapseBarTemplate-Content" , cut . Markup ) ;
674674 }
675675
676+
677+ [ Fact ]
678+ public void SkipAuthenticate_Ok ( )
679+ {
680+ // 未授权,通过控制 SkipAuthenticate 属性跳过授权
681+ var cut = Context . RenderComponent < CascadingValue < Task < AuthenticationState > > > ( pb =>
682+ {
683+ pb . Add ( a => a . Value , Task . FromResult ( new AuthenticationState ( new ClaimsPrincipal ( ) ) ) ) ;
684+ pb . AddChildContent < Layout > ( pb =>
685+ {
686+ pb . Add ( a => a . SkipAuthenticate , true ) ;
687+ pb . Add ( a => a . Main , builder => builder . AddContent ( 0 , "Main" ) ) ;
688+ } ) ;
689+ } ) ;
690+ cut . MarkupMatches ( "<section id:ignore class=\" layout\" style=\" --bb-layout-header-height: 0px; --bb-layout-footer-height: 0px;\" ><main class=\" layout-main\" >Main</main></section>" ) ;
691+ }
692+
676693 private static RenderFragment CreateHeader ( string ? content = "Header" ) => builder => builder . AddContent ( 0 , content ) ;
677694
678695 private static RenderFragment CreateFooter ( string ? content = "Footer" ) => builder => builder . AddContent ( 0 , content ) ;
You can’t perform that action at this time.
0 commit comments