Skip to content

Commit

Permalink
fix: use method instead of list
Browse files Browse the repository at this point in the history
  • Loading branch information
scottsauber committed Nov 2, 2023
1 parent 6e1ebbf commit b6f0be8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
18 changes: 18 additions & 0 deletions src/bunit.web.query/Labels/LabelOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using AngleSharp.Dom;

namespace Bunit;

internal static class LabelOptions
{
internal static bool IsHtmlElementThatCanHaveALabel(this IElement element) => element.NodeName switch
{
"INPUT" => true,
"SELECT" => true,
"TEXTAREA" => true,
"BUTTON" => true,
"METER" => true,
"OUTPUT" => true,
"PROGRESS" => true,
_ => false
};
}
15 changes: 0 additions & 15 deletions src/bunit.web.query/Labels/LabelQueryConstants.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ internal class LabelTextUsingWrappedElementStrategy : ILabelTextQueryStrategy

return matchingLabel?
.Children
.SingleOrDefault(n => LabelQueryConstants.HtmlElementsThatCanHaveALabel.Contains(n.NodeName, StringComparer.OrdinalIgnoreCase));
.SingleOrDefault(n => n.IsHtmlElementThatCanHaveALabel());
}
}

0 comments on commit b6f0be8

Please sign in to comment.