Skip to content

feat: add FindByRole#1816

Closed
scottsauber wants to merge 3 commits intomainfrom
findbyrole
Closed

feat: add FindByRole#1816
scottsauber wants to merge 3 commits intomainfrom
findbyrole

Conversation

@scottsauber
Copy link
Collaborator

@scottsauber scottsauber commented Mar 24, 2026

Pull request description

PR meta checklist

  • Pull request is targeted at main branch for code
    or targeted at stable branch for documentation that is live on bunit.dev.
  • Pull request is linked to all related issues, if any.
  • I have read the CONTRIBUTING.md document.

Code PR specific checklist

  • My code follows the code style of this project and AspNetCore coding guidelines.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have updated the appropriate sub section in the CHANGELOG.md.
  • I have added, updated or removed tests to according to my changes.
    • All tests passed.

Addresses part of #938

@scottsauber scottsauber changed the title feat: add findbyrole feat: add FindByRole Mar 24, 2026
{
internal static string? GetAccessibleName(IElement element, INodeList rootNodes)
{
// 1. aria-labelledby — resolve each referenced ID, join with spaces
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like we should consider our strategy pattern here.

var parent = element.ParentElement;
while (parent is not null)
{
if (parent.NodeName == "LABEL")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've got these magic strings in a few places... centralize?


private static bool MatchesOptions(IElement element, ByRoleOptions options, INodeList rootNodes)
{
// Name filter
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strategy pattern?

@scottsauber scottsauber mentioned this pull request Mar 24, 2026
@scottsauber
Copy link
Collaborator Author

Welp.... #1786 is better than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant