File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-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 BootstrapLabelTest : BootstrapBlazorTestBase
9+ {
10+ [ Fact ]
11+ public void BootstrapLabelSetting_LabelWidth_Ok ( )
12+ {
13+ var cut = Context . RenderComponent < BootstrapLabelSetting > ( pb =>
14+ {
15+ pb . Add ( a => a . LabelWidth , 120 ) ;
16+ pb . AddChildContent < BootstrapLabel > ( ) ;
17+ } ) ;
18+ Assert . Equal ( "<label class=\" form-label\" style=\" --bb-row-label-width: 120px;\" ></label>" , cut . Markup ) ;
19+
20+ var label = cut . FindComponent < BootstrapLabel > ( ) ;
21+ label . SetParametersAndRender ( pb =>
22+ {
23+ pb . Add ( a => a . LabelWidth , 80 ) ;
24+ } ) ;
25+ Assert . Equal ( "<label class=\" form-label\" style=\" --bb-row-label-width: 80px;\" ></label>" , cut . Markup ) ;
26+ }
27+
28+ [ Fact ]
29+ public void LabelWidth_Ok ( )
30+ {
31+ var cut = Context . RenderComponent < BootstrapLabel > ( ) ;
32+ Assert . Equal ( "<label class=\" form-label\" ></label>" , cut . Markup ) ;
33+
34+ cut . SetParametersAndRender ( pb =>
35+ {
36+ pb . Add ( a => a . LabelWidth , 120 ) ;
37+ } ) ;
38+ Assert . Equal ( "<label class=\" form-label\" style=\" --bb-row-label-width: 120px;\" ></label>" , cut . Markup ) ;
39+ }
40+ }
You can’t perform that action at this time.
0 commit comments