Skip to content

Commit

Permalink
update icon harness
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-ErikaMcVey committed Mar 3, 2025
1 parent af5025a commit dcc352d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function defaultSize(value: SkyIconSize | undefined): SkyIconSize {
styleUrls: ['./icon-svg.component.scss'],
host: {
'[class]':
'relativeSize() ? "sky-icon-svg-relative=" + relativeSize() : "sky-icon-svg-" + iconSize()',
'relativeSize() ? "sky-icon-svg-relative-" + relativeSize() : "sky-icon-svg-" + iconSize()',
},
hostDirectives: [SkyThemeComponentClassDirective],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ describe('Icon harness', () => {
}
});

it('should return the correct icon size when responsive size is used', async () => {
it('should return the correct icon size when relative size is used', async () => {
const { iconHarness, fixture } = await setupTest({
dataSkyId: 'svg-icon',
});
Expand Down
10 changes: 4 additions & 6 deletions libs/components/icon/testing/src/modules/icon/icon-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ export class SkyIconHarness extends SkyComponentHarness {
// match a class name that starts with `fa-` and follows with `lg`, `2x`, `3x`, `4x`, `5x`
if (/^fa-(?=2xs|lg|[2-5]+x)/.test(iconClass)) {
return iconClass.replace('fa-', '');
} else if (
/^sky-icon-svg-responsive-(?=2xs|lg|[2-5]+x)/.test(iconClass)
) {
return iconClass.replace('sky-icon-svg-responsive-', '');
} else if (/^sky-icon-svg-relative-(?=2xs|lg|[2-5]+x)/.test(iconClass)) {
return iconClass.replace('sky-icon-svg-relative-', '');
} else if (/^sky-icon-svg-(?=xxxs|xxs|xs|s|m|l|xl|xxl)/.test(iconClass)) {
return iconClass.replace('sky-icon-svg-', '');
}
Expand All @@ -65,7 +63,7 @@ export class SkyIconHarness extends SkyComponentHarness {
*/
public async getVariant(): Promise<string | undefined> {
const iconInfo = await this.#getSpecifiedIconInfo();
const svgIcon = await this.locatorForOptional('.sky-icon-svg')();
const svgIcon = await this.locatorForOptional('sky-icon-svg')();

if (svgIcon || iconInfo.iconType === 'skyux') {
return iconInfo.variant || 'line';
Expand All @@ -87,7 +85,7 @@ export class SkyIconHarness extends SkyComponentHarness {

async #getIcon(): Promise<TestElement> {
const icon = await this.locatorForOptional('.sky-icon')();
const svgIcon = await this.locatorForOptional('.sky-icon-svg')();
const svgIcon = await this.locatorForOptional('sky-icon-svg')();

if (icon) {
return icon;
Expand Down

0 comments on commit dcc352d

Please sign in to comment.