-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to disable internal Attributes for component.MarkupMatches(expected); #111
Comments
Maybe with a code extension here? Something like this public static bool IsBlazorAttribute(string attributeName)
=> attributeName.StartsWith(BLAZOR_ATTR_PREFIX, StringComparison.Ordinal)
|| attributeName.StartsWith("__internal_stopPropagation_", StringComparison.Ordinal)
|| attributeName.StartsWith("__internal_preventDefault_", StringComparison.Ordinal); |
Hey @samtrion Yeah, the specific attributes Blazor adds to the markup is handled in the Htmlizer class, so something like that would need to be added there. Can you show me the component that generates the markup? I will definitely add a fix in the next release. ps. thanks for bringing this to my attention! |
And to answer your question, yes, I think the best solution for now is to use If you want to help out with a PR on this, I would appreciate it. PRs should target the DEV branch. Without having given much thought to a solution, I think that it should actually be handled in the same way as event-handler-trackers, by changing the attribute name to have the |
Will create a PR. Use an internally created variant for now, until the next release. |
Awesome, much appreciated. Be warned, the project structure in the DEV branch has changed significantly. You will find Htmlizer.cs in the bunit.web project now - https://github.com/egil/bunit/blob/dev/src/bunit.web/Rendering/Internal/Htmlizer.cs. |
PR was created. Sorry about the Spacing Disaster. |
NO worries. Added my review. Ill just squash in the end. |
* Fixed Internal Attributes #111 Signed-off-by: samtrion <[email protected]> * Fixed spacing * Fixed spacing, second try * I'm so sorry, please squash * Update src/bunit.web/Rendering/Internal/Htmlizer.cs Co-Authored-By: Egil Hansen <[email protected]> * Added theory for handling internal attributes Signed-off-by: samtrion <[email protected]> * Added explanation Signed-off-by: samtrion <[email protected]> * Added test, which confirms correctly prefixed attributes Signed-off-by: samtrion <[email protected]>
Is there a way to exclude the Blazor internal attributes
__internal_stopPropagation_<eventname>
and__internal_preventDefault_<eventname>
from thecomponent.MarkupMatches(expected);
without marking each occurrence with:ignore
?The text was updated successfully, but these errors were encountered: