Skip to content

Instantly share code, notes, and snippets.

@iainbrighton
Created February 26, 2020 11:42
Show Gist options
  • Save iainbrighton/a88ca1bcdc5dffc4cf00d047062b1006 to your computer and use it in GitHub Desktop.
Save iainbrighton/a88ca1bcdc5dffc4cf00d047062b1006 to your computer and use it in GitHub Desktop.
OutHtml.Tests.ps1
It 'creates paragraph with embedded new line' {
$expected = '<div>Embedded<br />New Line</div>';
$paragraphText = 'Embedded{0}New Line' -f [System.Environment]::NewLine
$result = Paragraph $paragraphText | OutHtmlParagraph;
$result | Should BeExactly $expected;
}
It 'creates a tabular table cell with an embedded new line' {
$licenses = 'Standard{0}Professional{0}Enterprise' -f [System.Environment]::NewLine
$expected = '<td>Standard<br />Professional<br />Enterprise</td>';
$newLineTable = [PSCustomObject] @{ 'Licenses' = $licenses; }
$table = $newLineTable | Table -Name 'Test Table' | OutHtmlTable;
[Xml] $html = $table.Replace('&','&amp;');
$html.OuterXml | Should Match $expected;
}
It 'creates a list table cell with an embedded new line' {
$licenses = 'Standard{0}Professional{0}Enterprise' -f [System.Environment]::NewLine
$expected = '<td>Standard<br />Professional<br />Enterprise</td>';
$newLineTable = [PSCustomObject] @{ 'Licenses' = $licenses; }
$table = $newLineTable | Table -Name 'Test Table' | OutHtmlTable;
[Xml] $html = $table.Replace('&','&amp;');
$html.OuterXml | Should Match $expected;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment