From 4e39c94a74e729226af77b08836600a03d3b17c5 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Sat, 15 Nov 2025 11:50:10 +0100 Subject: [PATCH] refactor(material/button): adjust icon query Updates how we query for the icon to align with #32188. While implementing #32188, I was getting errors in some cases when the icons are missing. --- src/material/button/testing/button-harness.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/material/button/testing/button-harness.ts b/src/material/button/testing/button-harness.ts index 49edebcb25ce..7f3ba9eacff9 100644 --- a/src/material/button/testing/button-harness.ts +++ b/src/material/button/testing/button-harness.ts @@ -60,8 +60,9 @@ export class MatButtonHarness extends ContentContainerComponentHarness { .addOption('buttonType', options.buttonType, (harness, buttonType) => HarnessPredicate.stringMatches(harness.getType(), buttonType), ) - .addOption('iconName', options.iconName, (harness, iconName) => { - return harness.hasHarness(MatIconHarness.with({name: iconName})); + .addOption('iconName', options.iconName, async (harness, iconName) => { + const result = await harness.locatorForOptional(MatIconHarness.with({name: iconName}))(); + return result !== null; }); }