Skip to content

Commit

Permalink
Merge pull request #57 from mganss/devel
Browse files Browse the repository at this point in the history
Parse numerical font-weight in font shorthand
  • Loading branch information
FlorianRappl authored May 22, 2020
2 parents 496da0b + e6fe86d commit 1acc2a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/AngleSharp.Css.Tests/Declarations/CssFontProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -677,5 +677,17 @@ public void CssFontStyleWeightSizeHeightFamiliesLegal()
Assert.IsTrue(property.HasValue);
Assert.AreEqual("italic bold 12px / 30px Georgia, serif", property.Value);
}

[Test]
public void CssFontStyleNumericWeightSizeFamiliesLegal()
{
var snippet = "font: 400 12px Georgia, serif";
var property = ParseDeclaration(snippet);
Assert.AreEqual("font", property.Name);
Assert.IsFalse(property.IsImportant);
Assert.IsFalse(property.IsInherited);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("400 12px Georgia, serif", property.Value);
}
}
}
2 changes: 1 addition & 1 deletion src/AngleSharp.Css/Declarations/FontDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ICssValue Convert(StringSource source)

if (weight == null)
{
weight = source.ParseConstant(Map.FontWeights);
weight = FontWeightDeclaration.Converter.Convert(source);
source.SkipSpacesAndComments();
}

Expand Down

0 comments on commit 1acc2a5

Please sign in to comment.