Skip to content

Commit 7c24091

Browse files
committed
Fixed edge case for none in grid-template
1 parent ee42ad7 commit 7c24091

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,5 +768,13 @@ public void CssRuleWithOnlyGridTemplateAreasLegal_Issue27()
768768
var text = rule.CssText;
769769
Assert.AreEqual(snippet, text);
770770
}
771+
772+
[Test]
773+
public void CssGridTemplateLonghands_Issue68()
774+
{
775+
var snippet = "grid-template-areas: none; grid-template-columns: none; grid-template-rows: none";
776+
var style = ParseDeclarations(snippet);
777+
Assert.AreEqual("grid-template: none", style.CssText);
778+
}
771779
}
772780
}

src/AngleSharp.Css/Values/Composites/CssGridTemplateValue.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ public String CssText
6161
var rows = String.Empty;
6262
var cols = _columns?.CssText;
6363

64-
if (_areas != null)
64+
if (_areas is Constant<object> || _columns is Constant<object> || _rows is Constant<object>)
65+
{
66+
return CssKeywords.None;
67+
}
68+
else if (_areas != null)
6569
{
6670
var areas = ((CssTupleValue)_areas).Items;
6771
var rowItems = ((CssTupleValue)_rows).Items;
@@ -89,7 +93,7 @@ public String CssText
8993

9094
if (!String.IsNullOrEmpty(cols))
9195
{
92-
return String.Concat(rows, " / ",cols);
96+
return String.Concat(rows, " / ", cols);
9397
}
9498

9599
return rows;

0 commit comments

Comments
 (0)