File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,25 @@ public void ChildContent_Ok()
106106 Assert . NotNull ( button ) ;
107107 }
108108
109+ [ Fact ]
110+ public void BodyContext_Ok ( )
111+ {
112+ var cut = Context . RenderComponent < Drawer > ( builder =>
113+ {
114+ builder . Add ( a => a . BodyContext , "test-body-context" ) ;
115+ builder . Add ( a => a . ChildContent , s =>
116+ {
117+ s . OpenComponent < MockContent > ( 0 ) ;
118+ s . CloseComponent ( ) ;
119+ } ) ;
120+ } ) ;
121+
122+ var component = cut . FindComponent < MockContent > ( ) ;
123+ Assert . NotNull ( component ) ;
124+
125+ Assert . Equal ( "test-body-context" , component . Instance . GetBodyContext ( ) ) ;
126+ }
127+
109128 [ Fact ]
110129 public void ShowBackdrop_Ok ( )
111130 {
@@ -141,4 +160,13 @@ public void Position_Ok()
141160 } ) ;
142161 cut . Contains ( "--bb-drawer-position: absolute;" ) ;
143162 }
163+
164+ class MockContent : ComponentBase
165+ {
166+ [ CascadingParameter ( Name = "BodyContext" ) ]
167+ [ NotNull ]
168+ private object ? BodyContext { get ; set ; }
169+
170+ public string ? GetBodyContext ( ) => BodyContext . ToString ( ) ;
171+ }
144172}
You can’t perform that action at this time.
0 commit comments