Skip to content

Commit 8ea8ee0

Browse files
committed
Additional null checks in BunitHtmlParser, better naming of BlazorDiffingHelpers
1 parent 6d32e6a commit 8ea8ee0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/bunit.web/Diffing/BlazorDiffingHelpers.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
namespace Bunit.Diffing
44
{
55
/// <summary>
6-
/// Blazor Dffing Helpers
6+
/// Blazor Diffing Helpers
77
/// </summary>
88
public static class BlazorDiffingHelpers
99
{
1010
/// <summary>
1111
/// Represents a diffing filter that removes all special Blazor attributes added by the /<see cref="Htmlizer"/>.
1212
/// </summary>
13-
public static FilterDecision BlazorEventHandlerIdAttrFilter(in AttributeComparisonSource attrSource, FilterDecision currentDecision)
13+
public static FilterDecision BlazorAttributeFilter(in AttributeComparisonSource attrSource, FilterDecision currentDecision)
1414
{
1515
if (currentDecision == FilterDecision.Exclude)
1616
return currentDecision;
@@ -19,7 +19,6 @@ public static FilterDecision BlazorEventHandlerIdAttrFilter(in AttributeComparis
1919
return FilterDecision.Exclude;
2020

2121
return currentDecision;
22-
}
22+
}
2323
}
24-
2524
}

src/bunit.web/Diffing/HtmlComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public HtmlComparer()
2222
{
2323
var strategy = new DiffingStrategyPipeline();
2424
strategy.AddDefaultOptions();
25-
strategy.AddFilter(BlazorDiffingHelpers.BlazorEventHandlerIdAttrFilter, StrategyType.Specialized);
25+
strategy.AddFilter(BlazorDiffingHelpers.BlazorAttributeFilter, StrategyType.Specialized);
2626
_differenceEngine = new HtmlDiffer(strategy);
2727
}
2828

src/bunit.web/Rendering/BunitHtmlParser.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ public BunitHtmlParser() : this(Configuration.Default.WithCss().With(new HtmlCom
3737
/// with the <paramref name="testRenderer"/> registered.
3838
/// </summary>
3939
public BunitHtmlParser(ITestRenderer testRenderer, HtmlComparer htmlComparer)
40-
: this(Configuration.Default.WithCss().With(testRenderer).With(htmlComparer)) { }
40+
: this(Configuration.Default.WithCss()
41+
.With(testRenderer ?? throw new ArgumentNullException(nameof(testRenderer)))
42+
.With(htmlComparer ?? throw new ArgumentNullException(nameof(htmlComparer)))) { }
4143

4244
private BunitHtmlParser(IConfiguration angleSharpConfiguration)
4345
{

0 commit comments

Comments
 (0)