Skip to content

Commit 7cfd58a

Browse files
authored
Add script / style to pre tests
1 parent f62242e commit 7cfd58a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tests/Strategies/TextNodeStrategies/TextNodeComparerTest.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,30 @@ public void Test004()
116116
sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
117117
}
118118

119-
[Fact(DisplayName = "When the parent element is <pre>, the is implicitly set to Preserve")]
120-
public void Test005()
119+
[Theory(DisplayName = "When the parent element is <pre/script/style>, the is implicitly set to Preserve")]
120+
[InlineData("pre")]
121+
[InlineData("script")]
122+
[InlineData("style")]
123+
public void Test005(string tag)
121124
{
122125
var sut = new TextNodeComparer(WhitespaceOption.Normalize);
123-
var pre = ToComparisonSource("<pre>foo bar</pre>");
124-
var controlSource = new ComparisonSource(pre.Node.FirstChild, 0, pre.Path, ComparisonSourceType.Control);
126+
var elm = ToComparisonSource($"<{tag}>foo bar</{tag}>");
127+
var controlSource = new ComparisonSource(elm.Node.FirstChild, 0, elm.Path, ComparisonSourceType.Control);
125128
var testSource = ToComparisonSource("foo bar", ComparisonSourceType.Test);
126129
var comparison = new Comparison(controlSource, testSource);
127130

128131
sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Different);
129132
}
130133

131-
[Fact(DisplayName = "When the parent element is <pre> and the whitespace option is set inline, the inline option is used instead of Preserve")]
132-
public void Test006()
134+
[Theory(DisplayName = "When the parent element is <pre/script/style> and the whitespace option is set inline, the inline option is used instead of Preserve")]
135+
[InlineData("pre")]
136+
[InlineData("script")]
137+
[InlineData("style")]
138+
public void Test006(string tag)
133139
{
134140
var sut = new TextNodeComparer(WhitespaceOption.Normalize);
135-
var pre = ToComparisonSource("<pre diff:whitespace=\"normalize\">foo bar</pre>");
136-
var controlSource = new ComparisonSource(pre.Node.FirstChild, 0, pre.Path, ComparisonSourceType.Control);
141+
var elm = ToComparisonSource("<{tag} diff:whitespace=\"normalize\">foo bar</{tag}>");
142+
var controlSource = new ComparisonSource(elm.Node.FirstChild, 0, elm.Path, ComparisonSourceType.Control);
137143
var testSource = ToComparisonSource("foo bar", ComparisonSourceType.Test);
138144
var comparison = new Comparison(controlSource, testSource);
139145

0 commit comments

Comments
 (0)