File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
src/BootstrapBlazor/Components/Drawer Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,12 @@ public partial class Drawer
2828 /// 获得 抽屉 Style 字符串
2929 /// </summary>
3030 private string ? DrawerStyleString => CssBuilder . Default ( )
31- . AddClass ( $ "--bb-drawer-width: { Width } ;", Placement != Placement . Top && Placement != Placement . Bottom )
32- . AddClass ( $ "--bb-drawer-height: { Height } ;", Placement == Placement . Top || Placement == Placement . Bottom )
31+ . AddClass ( $ "--bb-drawer-width: { Width } ;", ! string . IsNullOrEmpty ( Width ) && ! IsVertical )
32+ . AddClass ( $ "--bb-drawer-height: { Height } ;", ! string . IsNullOrEmpty ( Height ) && IsVertical )
3333 . Build ( ) ;
3434
35+ private bool IsVertical => Placement == Placement . Top || Placement == Placement . Bottom ;
36+
3537 /// <summary>
3638 /// 获得 抽屉样式
3739 /// </summary>
Original file line number Diff line number Diff line change @@ -11,13 +11,13 @@ public class DrawerTest : BootstrapBlazorTestBase
1111 public void Width_Ok ( )
1212 {
1313 var cut = Context . RenderComponent < Drawer > ( builder => builder . Add ( a => a . Width , "100px" ) ) ;
14- Assert . Contains ( "width: 100px" , cut . Markup ) ;
14+ Assert . Contains ( "--bb-drawer- width: 100px; " , cut . Markup ) ;
1515
1616 cut . SetParametersAndRender ( pb =>
1717 {
1818 pb . Add ( a => a . Width , "" ) ;
1919 } ) ;
20- Assert . DoesNotContain ( "width: " , cut . Markup ) ;
20+ Assert . DoesNotContain ( "--bb-drawer- width" , cut . Markup ) ;
2121 }
2222
2323 [ Fact ]
@@ -28,13 +28,13 @@ public void Height_Ok()
2828 builder . Add ( a => a . Height , "100px" ) ;
2929 builder . Add ( a => a . Placement , Placement . Top ) ;
3030 } ) ;
31- Assert . Contains ( "height: 100px" , cut . Markup ) ;
31+ Assert . Contains ( "--bb-drawer- height: 100px" , cut . Markup ) ;
3232
3333 cut . SetParametersAndRender ( pb =>
3434 {
3535 pb . Add ( a => a . Height , "" ) ;
3636 } ) ;
37- Assert . DoesNotContain ( "height:" , cut . Markup ) ;
37+ Assert . DoesNotContain ( "--bb-drawer- height:" , cut . Markup ) ;
3838 }
3939
4040 [ Fact ]
You can’t perform that action at this time.
0 commit comments