Fixed stroke-width without unit #18

This commit is contained in:
Florian Rappl 2019-05-05 23:49:48 +02:00
Родитель 847d59a3bd
Коммит 54ac3a8276
3 изменённых файлов: 18 добавлений и 3 удалений

Просмотреть файл

@ -6,6 +6,7 @@ Released on Thursday, May 5 2019.
- Fixed empty value when removing properties (#14)
- Returns `null` in `GetStyle` if CSS not configured (#15)
- Added `pointer-events` and fixed border recombination (#16)
- Fixed `stroke-width` value without unit (#18)
- Fixed exception when not providing an `IRenderDevice` (#20)
- Fixed missing `CssStylingService.Default` in cascade (#21)
- Added extension helper `SetStyle` to modify all styles of many elements (#22)

Просмотреть файл

@ -1,4 +1,4 @@
namespace AngleSharp.Css.Tests.Declarations
namespace AngleSharp.Css.Tests.Declarations
{
using NUnit.Framework;
using static CssConstructionFunctions;
@ -370,5 +370,17 @@
Assert.IsFalse(property.IsInherited);
Assert.IsFalse(property.HasValue);
}
[Test]
public void CssStrokeWithoutUnit_Issue18()
{
var snippet = "stroke-width: 3";
var property = ParseDeclaration(snippet);
Assert.AreEqual("stroke-width", property.Name);
Assert.IsFalse(property.IsImportant);
Assert.IsFalse(property.IsInherited);
Assert.IsTrue(property.HasValue);
Assert.AreEqual("3", property.Value);
}
}
}

Просмотреть файл

@ -7,8 +7,10 @@ namespace AngleSharp.Css.Declarations
{
public static String Name = PropertyNames.StrokeWidth;
public static IValueConverter Converter = LengthOrPercentConverter;
public static IValueConverter Converter = Or(
LengthOrPercentConverter,
NumberConverter);
public static PropertyFlags Flags = PropertyFlags.Animatable;
public static PropertyFlags Flags = PropertyFlags.Unitless | PropertyFlags.Animatable;
}
}