Skip to content

Commit 765635d

Browse files
committed
Ensure only event handler names are included in error message as options for other events that can be triggered
1 parent 1d78c05 commit 765635d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/bunit.web/EventDispatchExtensions/MissingEventHandlerException.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ public MissingEventHandlerException(IElement element, string missingEventName) :
1919
private static string CreateErrorMessage(IElement element, string missingEventName)
2020
{
2121
var result = $"The element does not have an event handler for the event '{missingEventName}'";
22-
// TODO: This should also filter out the other non-eventHandler attributes like stoProporgation
2322
var eventHandlers = element.Attributes?
24-
.Where(x => x.Name.StartsWith(Htmlizer.BLAZOR_ATTR_PREFIX, StringComparison.Ordinal) && !x.Name.StartsWith(Htmlizer.ELEMENT_REFERENCE_ATTR_NAME, StringComparison.Ordinal))
23+
.Where(x => x.Name.StartsWith(Htmlizer.BLAZOR_ATTR_PREFIX + "on", StringComparison.Ordinal))
2524
.Select(x => $"'{x.Name.Remove(0, Htmlizer.BLAZOR_ATTR_PREFIX.Length)}'")
2625
.ToArray() ?? Array.Empty<string>();
2726

0 commit comments

Comments
 (0)