File tree Expand file tree Collapse file tree
ExCSS.Tests/PropertyTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using Xunit ;
2+
3+ namespace ExCSS . Tests . PropertyTests
4+ {
5+ public class BoxSizingPropertyTests : CssConstructionFunctions
6+ {
7+ [ Fact ]
8+ public void BoxSizingContentBoxLegal ( )
9+ {
10+ var snippet = "box-sizing: content-box" ;
11+ var property = ParseDeclaration ( snippet ) ;
12+ Assert . Equal ( "box-sizing" , property . Name ) ;
13+ Assert . False ( property . IsImportant ) ;
14+ Assert . IsType < BoxSizingProperty > ( property ) ;
15+ var concrete = ( BoxSizingProperty ) property ;
16+ Assert . False ( concrete . IsInherited ) ;
17+ Assert . True ( concrete . HasValue ) ;
18+ Assert . Equal ( "content-box" , concrete . Value ) ;
19+ }
20+
21+ [ Fact ]
22+ public void BoxSizingBorderBoxLegal ( )
23+ {
24+ var snippet = "box-sizing: border-box" ;
25+ var property = ParseDeclaration ( snippet ) ;
26+ Assert . Equal ( "box-sizing" , property . Name ) ;
27+ Assert . False ( property . IsImportant ) ;
28+ Assert . IsType < BoxSizingProperty > ( property ) ;
29+ var concrete = ( BoxSizingProperty ) property ;
30+ Assert . False ( concrete . IsInherited ) ;
31+ Assert . True ( concrete . HasValue ) ;
32+ Assert . Equal ( "border-box" , concrete . Value ) ;
33+ }
34+ }
35+ }
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ private PropertyFactory()
6161
6262 AddLonghand ( PropertyNames . BorderSpacing , ( ) => new BorderSpacingProperty ( ) ) ;
6363 AddLonghand ( PropertyNames . BorderCollapse , ( ) => new BorderCollapseProperty ( ) ) ;
64+ AddLonghand ( PropertyNames . BoxSizing , ( ) => new BoxSizingProperty ( ) ) ;
6465 AddLonghand ( PropertyNames . BoxShadow , ( ) => new BoxShadowProperty ( ) , true ) ;
6566 AddLonghand ( PropertyNames . BoxDecorationBreak , ( ) => new BoxDecorationBreak ( ) ) ;
6667 AddLonghand ( PropertyNames . BreakAfter , ( ) => new BreakAfterProperty ( ) ) ;
Original file line number Diff line number Diff line change @@ -442,6 +442,7 @@ public static readonly IValueConverter
442442 public static readonly IValueConverter BoxDecorationConverter = Toggle ( Keywords . Clone , Keywords . Slice ) ;
443443 public static readonly IValueConverter ColumnSpanConverter = Toggle ( Keywords . All , Keywords . None ) ;
444444 public static readonly IValueConverter ColumnFillConverter = Toggle ( Keywords . Balance , Keywords . Auto ) ;
445+ public static readonly IValueConverter BoxSizingConverter = Toggle ( Keywords . ContentBox , Keywords . BorderBox ) ;
445446
446447 #endregion
447448
Original file line number Diff line number Diff line change 1+ namespace ExCSS
2+ {
3+ internal class BoxSizingProperty : Property
4+ {
5+ private static readonly IValueConverter StyleConverter = Converters . BoxSizingConverter . OrDefault ( Keywords . ContentBox ) ;
6+
7+ public BoxSizingProperty ( )
8+ : base ( PropertyNames . BoxSizing , PropertyFlags . None )
9+ { }
10+
11+ internal override IValueConverter Converter => StyleConverter ;
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments