Skip to content

Commit cf7a203

Browse files
authored
chore(icon-table-cell-renderer): add label on icons (#353)
1 parent 1767a7b commit cf7a203

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

projects/components/src/table/cells/data-parsers/table-cell-icon-parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type FilterValue = string | boolean | undefined;
3030

3131
export interface IconData {
3232
icon: string;
33+
label?: string;
3334
color?: string;
3435
size?: IconSize;
3536
filterValue?: FilterValue;

projects/components/src/table/cells/data-renderers/icon/icon-table-cell-renderer.component.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ describe('Icon table cell renderer component', () => {
1919
},
2020
new TableCellIconParser(undefined!),
2121
0,
22-
IconType.AddCircleOutline
22+
{
23+
icon: IconType.AddCircleOutline,
24+
label: 'I am Label'
25+
}
2326
)
2427
],
2528
shallow: true
@@ -31,7 +34,7 @@ describe('Icon table cell renderer component', () => {
3134
const element = spectator.query('.ht-icon');
3235

3336
expect(element).toHaveExactText(IconType.AddCircleOutline);
34-
expect(element).toHaveAttribute('aria-label', 'add_circle_outline');
37+
expect(element).toHaveAttribute('aria-label', 'I am Label');
3538
});
3639

3740
test('should not add clickable class for clickable columns', () => {

projects/components/src/table/cells/data-renderers/icon/icon-table-cell-renderer.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { TableCellAlignmentType } from '../../types/table-cell-alignment-type';
2424
<div class="icon-cell" [ngClass]="{ clickable: this.clickable }" *ngIf="this.value">
2525
<ht-icon
2626
[icon]="this.value.icon"
27+
[label]="this.value.label"
2728
[size]="this.iconSize"
2829
[showTooltip]="true"
2930
[style.color]="this.value.color"

0 commit comments

Comments
 (0)