Skip to content
This repository was archived by the owner on Jul 13, 2022. It is now read-only.

Commit d1dba10

Browse files
committed
fix(icon.directive): add role attr
1 parent 4211463 commit d1dba10

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

projects/coreui-icons-angular/src/lib/icon/icon.directive.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ describe('IconDirective', () => {
4949
expect(directive).toBeTruthy();
5050
});
5151
it('icon classes should be applied', () => {
52-
console.log(svgEl.nativeElement);
5352
expect(svgEl.nativeElement).toBeTruthy();
5453
expect(svgEl.nativeElement).toHaveClass('icon');
5554
expect(svgEl.nativeElement).toHaveClass('icon-lg');

projects/coreui-icons-angular/src/lib/icon/icon.directive.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class IconDirective implements IIcon {
1919

2020
@Input()
2121
set name(name: string) {
22-
this._name = name.includes('-') ? this.toCamelCase(name) : name;
22+
this._name = name?.includes('-') ? this.toCamelCase(name) : name;
2323
}
2424
get name(): string {
2525
return this._name;
@@ -42,6 +42,9 @@ export class IconDirective implements IIcon {
4242
@HostBinding('attr.pointer-events')
4343
@Input('pointer-events') pointerEvents = 'none';
4444

45+
@HostBinding('attr.role')
46+
@Input() role = 'img';
47+
4548
@HostBinding('class')
4649
get hostClasses() {
4750
const classes = {

0 commit comments

Comments
 (0)