Skip to content

Commit bc88f62

Browse files
committed
Fixed border-style #35
1 parent 275b0f4 commit bc88f62

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Added `MinifyStyleFormatter`
88
- Added `Prettify` and `Minify` extension methods
99
- Fixed border-style expansion order (#34)
10+
- Fixed text-decoration expansion order (#35)
1011

1112
# 0.12.1
1213

src/AngleSharp.Css.Tests/Declarations/CssTextProperty.cs

+16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
namespace AngleSharp.Css.Tests.Declarations
22
{
3+
using AngleSharp.Css.Dom;
4+
using AngleSharp.Dom;
35
using NUnit.Framework;
46
using static CssConstructionFunctions;
57

@@ -195,6 +197,20 @@ public void CssTextDecorationLegalLineThrough()
195197
Assert.AreEqual("line-through", property.Value);
196198
}
197199

200+
[Test]
201+
public void CssTextDecorationExpandCorrectly_Issue35()
202+
{
203+
var source = @"<!DOCTYPE html>
204+
<html>
205+
<head><title></title></head>
206+
<body style=""text-decoration: underline dotted;""></body>
207+
</html>";
208+
var document = source.ToHtmlDocument(Configuration.Default.WithCss());
209+
var styleDeclaration = document.Body.ComputeCurrentStyle();
210+
Assert.AreEqual("dotted", styleDeclaration.GetTextDecorationStyle());
211+
Assert.AreEqual("underline", styleDeclaration.GetTextDecorationLine());
212+
}
213+
198214
[Test]
199215
public void CssTextDecorationLegalUnderlineOverline()
200216
{

src/AngleSharp.Css/Declarations/TextDecorationDeclaration.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ static class TextDecorationDeclaration
1212
public static IValueConverter Converter = AggregateTuple(
1313
WithAny(
1414
ColorConverter.Option(InitialValues.TextDecorationColorDecl),
15-
TextDecorationStyleConverter.Option(InitialValues.TextDecorationLineDecl),
16-
TextDecorationLinesConverter.Option(InitialValues.TextDecorationStyleDecl)));
15+
TextDecorationStyleConverter.Option(InitialValues.TextDecorationStyleDecl),
16+
TextDecorationLinesConverter.Option(InitialValues.TextDecorationLineDecl)));
1717

1818
public static ICssValue InitialValue = null;
1919

@@ -22,8 +22,8 @@ static class TextDecorationDeclaration
2222
public static String[] Longhands = new[]
2323
{
2424
PropertyNames.TextDecorationColor,
25-
PropertyNames.TextDecorationLine,
2625
PropertyNames.TextDecorationStyle,
26+
PropertyNames.TextDecorationLine,
2727
};
2828
}
2929
}

src/AngleSharp.Css/Dom/StyleDeclarationExtensions.cs

+48
Original file line numberDiff line numberDiff line change
@@ -3484,6 +3484,54 @@ public static String GetTextDecoration(this ICssStyleDeclaration style) =>
34843484
public static void SetTextDecoration(this ICssStyleDeclaration style, String value) =>
34853485
style.SetProperty(PropertyNames.TextDecoration, value);
34863486

3487+
/// <summary>
3488+
/// Gets a value that indicates the style of the text decoration.
3489+
/// </summary>
3490+
[DomName("textDecorationStyle")]
3491+
[DomAccessor(Accessors.Getter)]
3492+
public static String GetTextDecorationStyle(this ICssStyleDeclaration style) =>
3493+
style.GetPropertyValue(PropertyNames.TextDecorationStyle);
3494+
3495+
/// <summary>
3496+
/// Sets a value that indicates the style of the text decoration.
3497+
/// </summary>
3498+
[DomName("textDecorationStyle")]
3499+
[DomAccessor(Accessors.Setter)]
3500+
public static void SetTextDecorationStyle(this ICssStyleDeclaration style, String value) =>
3501+
style.SetProperty(PropertyNames.TextDecorationStyle, value);
3502+
3503+
/// <summary>
3504+
/// Gets a value that indicates the line of the text decoration.
3505+
/// </summary>
3506+
[DomName("textDecorationLine")]
3507+
[DomAccessor(Accessors.Getter)]
3508+
public static String GetTextDecorationLine(this ICssStyleDeclaration style) =>
3509+
style.GetPropertyValue(PropertyNames.TextDecorationLine);
3510+
3511+
/// <summary>
3512+
/// Sets a value that indicates the line of the text decoration.
3513+
/// </summary>
3514+
[DomName("textDecorationLine")]
3515+
[DomAccessor(Accessors.Setter)]
3516+
public static void SetTextDecorationLine(this ICssStyleDeclaration style, String value) =>
3517+
style.SetProperty(PropertyNames.TextDecorationLine, value);
3518+
3519+
/// <summary>
3520+
/// Gets a value that indicates the color of the text decoration.
3521+
/// </summary>
3522+
[DomName("textDecorationColor")]
3523+
[DomAccessor(Accessors.Getter)]
3524+
public static String GetTextDecorationColor(this ICssStyleDeclaration style) =>
3525+
style.GetPropertyValue(PropertyNames.TextDecorationColor);
3526+
3527+
/// <summary>
3528+
/// Sets a value that indicates the color of the text decoration.
3529+
/// </summary>
3530+
[DomName("textDecorationColor")]
3531+
[DomAccessor(Accessors.Setter)]
3532+
public static void SetTextDecorationColor(this ICssStyleDeclaration style, String value) =>
3533+
style.SetProperty(PropertyNames.TextDecorationColor, value);
3534+
34873535
/// <summary>
34883536
/// Gets the indentation of the first line of text in the
34893537
/// object.

0 commit comments

Comments
 (0)