Skip to content

Commit 03140ed

Browse files
committed
Added fill declaration #59
1 parent 5d034bf commit 03140ed

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.14.3
2+
3+
Released on ?
4+
5+
- Added `fill` declaration (#59)
6+
17
# 0.14.2
28

39
Released on Thursday, June 11 2020.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace AngleSharp.Css.Tests.Declarations
2+
{
3+
using NUnit.Framework;
4+
using static CssConstructionFunctions;
5+
6+
[TestFixture]
7+
public class CssFillPropertyTests
8+
{
9+
[Test]
10+
public void CssFillColorFromHexLegal()
11+
{
12+
var snippet = "fill:#AFAA96";
13+
var property = ParseDeclaration(snippet);
14+
Assert.AreEqual("fill", property.Name);
15+
Assert.IsTrue(property.HasValue);
16+
Assert.AreEqual("rgba(175, 170, 150, 1)", property.Value);
17+
}
18+
19+
[Test]
20+
public void CssFillNoneKeywordLegal()
21+
{
22+
var snippet = "fill:none";
23+
var property = ParseDeclaration(snippet);
24+
Assert.AreEqual("fill", property.Name);
25+
Assert.IsTrue(property.HasValue);
26+
Assert.AreEqual("none", property.Value);
27+
}
28+
}
29+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace AngleSharp.Css.Declarations
2+
{
3+
using AngleSharp.Css.Dom;
4+
using System;
5+
using static ValueConverters;
6+
7+
static class FillDeclaration
8+
{
9+
public static String Name = PropertyNames.Fill;
10+
11+
public static IValueConverter Converter = PaintConverter;
12+
13+
public static ICssValue InitialValue = InitialValues.ColorDecl;
14+
15+
public static PropertyFlags Flags = PropertyFlags.Inherited | PropertyFlags.Hashless | PropertyFlags.Animatable;
16+
}
17+
}

src/AngleSharp.Css/Factories/DefaultDeclarationFactory.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,13 @@ public class DefaultDeclarationFactory : IDeclarationFactory
17211721
longhands: GridGapDeclaration.Longhands,
17221722
flags: GridGapDeclaration.Flags)
17231723
},
1724+
{
1725+
FillDeclaration.Name, new DeclarationInfo(
1726+
name: FillDeclaration.Name,
1727+
converter: FillDeclaration.Converter,
1728+
initialValue: FillDeclaration.InitialValue,
1729+
flags: FillDeclaration.Flags)
1730+
},
17241731
};
17251732

17261733
/// <summary>

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
<PropertyGroup>
33
<Description>Extends the CSSOM from the core AngleSharp library.</Description>
44
<Product>AngleSharp.Css</Product>
5-
<Version>0.14.2</Version>
5+
<Version>0.14.3</Version>
66
</PropertyGroup>
77
</Project>

0 commit comments

Comments
 (0)