Skip to content

Commit

Permalink
Merge pull request #167 from pauloortins/fix-flex-auto
Browse files Browse the repository at this point in the history
Fix flex: auto parsing
  • Loading branch information
TylerBrinks authored Oct 2, 2023
2 parents fae6c5b + 384de5d commit 9dc686c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/ExCSS.Tests/PropertyTests/FlexPropertyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,19 @@ public void JustifyAlign_Parses()
Assert.Equal(@"center", info.Style.AlignSelf);
Assert.Equal(@"center", info.Style.JustifyContent);
}

[Fact]
public void FlexAuto_Parses()
{
string css = """
html {
flex: auto;
}
""";

var stylesheet = new StylesheetParser().Parse(css);
var info = stylesheet.StyleRules.First() as ExCSS.StyleRule;
Assert.Equal(@"1 1 auto", info.Style.Flex);
}
}
}
2 changes: 1 addition & 1 deletion src/ExCSS/Model/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public static readonly IValueConverter

public static readonly IValueConverter FlexConverter = Construct(() =>
{
var flexGrow = FlexGrowShrinkConverter.WithFallback(0).For(PropertyNames.FlexGrow);
var flexGrow = FlexGrowShrinkConverter.WithFallback(1).For(PropertyNames.FlexGrow);
var flexShrink = FlexGrowShrinkConverter.WithFallback(1).For(PropertyNames.FlexShrink);
var flexBasis = FlexBasisConverter.WithFallback(0).For(PropertyNames.FlexBasis);

Expand Down

0 comments on commit 9dc686c

Please sign in to comment.