-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): styles of group popover control & a11y issues
- Loading branch information
1 parent
27fbc55
commit 6799de9
Showing
6 changed files
with
102 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
libs/core/src/lib/avatar-group/directives/avatar-group-popover-control.directive.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { Component, ElementRef, ViewChild } from '@angular/core'; | ||
|
||
import { AvatarGroupModule } from '../avatar-group.module'; | ||
|
||
@Component({ | ||
template: `<fd-avatar #directiveElement fd-avatar-group-popover-control></fd-avatar>` | ||
}) | ||
class TestComponent { | ||
@ViewChild('directiveElement', { static: false }) | ||
ref: ElementRef; | ||
} | ||
|
||
describe('AvatarGroupPopoverControlDirective', () => { | ||
let component: TestComponent; | ||
let fixture: ComponentFixture<TestComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [TestComponent], | ||
imports: [AvatarGroupModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(TestComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should assign class', () => { | ||
expect(component.ref.nativeElement).toHaveClass('fd-avatar-group__popover-control'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
libs/core/src/lib/avatar-group/directives/avatar-group-popover-control.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Directive, HostBinding, Input } from '@angular/core'; | ||
|
||
/** Needed to bind specific class to group type popover control. */ | ||
@Directive({ | ||
// tslint:disable-next-line:directive-selector | ||
selector: '[fd-avatar-group-popover-control]', | ||
host: { class: 'fd-avatar-group__popover-control' } | ||
}) | ||
export class AvatarGroupPopoverControlDirective { | ||
/** Tabindex of the popover control. */ | ||
@Input() | ||
@HostBinding('attr.tabindex') | ||
tabindex = 0; | ||
|
||
/** Role of the popover control. */ | ||
@Input() | ||
@HostBinding('attr.role') | ||
role = 'button'; | ||
} |