Skip to content

Conversation

wildcardalice
Copy link
Contributor

@wildcardalice wildcardalice commented Sep 11, 2025

In its current implementation, icon buttons and FABs are more difficult to filter for compared to text-based buttons, which can use their { text} filter property, usually relying on a custom selector (eg: class or id) or ancestor. This change aims to simplify this by allowing a user to filter via a contained icon. The filtering logic is quite simple and reuses the existing logic inside MatIconHarness for simplicity and reliability.

Example usage:

const iconButton = await getHarness(MatButtonHarness.with({ iconName: "favorite" }));

@wildcardalice wildcardalice requested a review from a team as a code owner September 11, 2025 20:33
@wildcardalice wildcardalice requested review from mmalerba and tjshiu and removed request for a team September 11, 2025 20:33
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: material/testing labels Sep 11, 2025
@wildcardalice wildcardalice force-pushed the alice/icon-button-filtering branch from ca44fed to 183a3d2 Compare September 16, 2025 16:11
@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Sep 16, 2025
@wildcardalice wildcardalice changed the title Add icon name filtering to MatButtonHarness feat(material/testing): Add icon name filtering to MatButtonHarness Sep 18, 2025
@andrewseguin andrewseguin added the target: major This PR is targeted for the next major release label Sep 18, 2025
@andrewseguin andrewseguin merged commit 3619903 into angular:main Sep 18, 2025
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: material/testing detected: feature PR contains a feature commit target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants