Skip to content

Commit b760d60

Browse files
committed
refactor(material/button): adjust icon query (angular#32355)
Updates how we query for the icon to align with angular#32188. While implementing angular#32188, I was getting errors in some cases when the icons are missing. (cherry picked from commit 9cf1501)
1 parent 610baa4 commit b760d60

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/material/button/testing/button-harness.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ export class MatButtonHarness extends ContentContainerComponentHarness {
6060
.addOption('buttonType', options.buttonType, (harness, buttonType) =>
6161
HarnessPredicate.stringMatches(harness.getType(), buttonType),
6262
)
63-
.addOption('iconName', options.iconName, (harness, iconName) => {
64-
return harness.hasHarness(MatIconHarness.with({name: iconName}));
63+
.addOption('iconName', options.iconName, async (harness, iconName) => {
64+
const result = await harness.locatorForOptional(MatIconHarness.with({name: iconName}))();
65+
return result !== null;
6566
});
6667
}
6768

0 commit comments

Comments
 (0)