+ await converter.ParseBody(@"
Header placeholder:
@@ -164,19 +164,46 @@ public async Task WithBorders_ReturnsAsOneFramedBlock()
AssertThatOpenXmlDocumentIsValid();
var paragraphs = mainPart.Document.Body!.Elements();
- Assert.That(paragraphs, Is.Not.Empty);
- Assert.That(paragraphs.Select(p => p.ParagraphProperties?.ParagraphBorders), Has.All.Not.Empty);
- Assert.That(paragraphs.SelectMany(p => p.ParagraphProperties?.ParagraphBorders!.Elements()!)
+ Assert.That(paragraphs, Is.Empty, "Assert that all the paragraphs stand inside the framed table");
+
+ var framedTable = mainPart.Document.Body!.Elements().FirstOrDefault();
+ Assert.That(framedTable, Is.Not.Null);
+
+ var borders = framedTable.GetFirstChild()?.TableBorders;
+ Assert.That(borders, Is.Not.Null, "Assert that border is applied on table scope");
+ Assert.That(borders.Elements()!
.Select(b => b.Val?.Value),
Has.All.EqualTo(BorderValues.Dashed));
- Assert.That(paragraphs.Take(paragraphs.Count() - 1)
- .Select(p => p.ParagraphProperties?.Indentation?.Right?.Value), Has.All.EqualTo("0"),
- "Assert that all paragraphs right indentation is reset");
+ var cell = framedTable.GetFirstChild()?.GetFirstChild();
+ Assert.That(cell, Is.Not.Null);
+ paragraphs = cell.Elements();
+ Assert.That(paragraphs, Is.Not.Empty);
+
Assert.That(paragraphs.Last().ParagraphProperties?.Indentation?.FirstLine?.Value, Is.EqualTo("1080"),
"Assert that paragraph with text-indent is preserved");
Assert.That(paragraphs.Last().ParagraphProperties?.Indentation?.Right, Is.Null,
"Assert that paragraph with right indentation is preserved");
}
+
+ [Test(Description = "Background color defined on container should render its content with one bordered frame")]
+ public async Task WithBgcolor_MultipleParagraphs_ReturnsAsOneFramedBlock()
+ {
+ await converter.ParseBody(@"
+
+ Body Placeholder
+ ");
+ AssertThatOpenXmlDocumentIsValid();
+
+ var paragraphs = mainPart.Document.Body!.Elements();
+ Assert.That(paragraphs, Is.Empty, "Assert that all the paragraphs stand inside the framed table");
+
+ var framedTable = mainPart.Document.Body!.Elements().FirstOrDefault();
+ Assert.That(framedTable, Is.Not.Null);
+
+ var shading = framedTable.GetFirstChild()?.GetFirstChild()?.TableCellProperties?.Shading;
+ Assert.That(shading, Is.Not.Null, "Assert that background-color is applied on table scope");
+ Assert.That(shading.Fill?.Value, Is.EqualTo("FFA500"));
+ }
}
}
\ No newline at end of file