Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a8addb

Browse files
committed
add test coverage for interpolated ARIA attributes and longer ARIA names
1 parentaf14872 commit5a8addb

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

‎packages/core/test/acceptance/property_binding_spec.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,26 +131,51 @@ describe('property bindings', () => {
131131

132132
it('should bind ARIA properties to their corresponding attributes',()=>{
133133
@Component({
134-
template:'<button [ariaLabel]="label"></button>',
134+
template:'<button [ariaLabel]="label" [ariaHasPopup]="hasPopup"></button>',
135135
})
136136
classMyComp{
137137
label?:string;
138+
hasPopup?:string;
138139
}
139140

140141
constfixture=TestBed.createComponent(MyComp);
141142
constbutton=fixture.debugElement.query(By.css('button')).nativeElement;
142143

143144
fixture.componentInstance.label='Open';
145+
fixture.componentInstance.hasPopup='menu';
144146
fixture.detectChanges();
145147

146148
expect(button.getAttribute('aria-label')).toBe('Open');
149+
expect(button.getAttribute('aria-haspopup')).toBe('menu');
147150

148151
fixture.componentInstance.label='Close';
149152
fixture.detectChanges();
150153

151154
expect(button.getAttribute('aria-label')).toBe('Close');
152155
});
153156

157+
it('should bind interpolated ARIA attributes',()=>{
158+
@Component({
159+
template:'<button aria-label="{{label}} menu"></button>',
160+
})
161+
classMyComp{
162+
label?:string;
163+
}
164+
165+
constfixture=TestBed.createComponent(MyComp);
166+
constbutton=fixture.debugElement.query(By.css('button')).nativeElement;
167+
168+
fixture.componentInstance.label='Open';
169+
fixture.detectChanges();
170+
171+
expect(button.getAttribute('aria-label')).toBe('Open menu');
172+
173+
fixture.componentInstance.label='Close';
174+
fixture.detectChanges();
175+
176+
expect(button.getAttribute('aria-label')).toBe('Close menu');
177+
});
178+
154179
describe('should bind to ARIA attribute names',()=>{
155180
it('on HTML elements',()=>{
156181
@Component({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp