Skip to content

Commit

Permalink
fix(rating): correct aria attribute setting
Browse files Browse the repository at this point in the history
Closes #1479
  • Loading branch information
troy authored and pkozlowski-opensource committed Apr 12, 2017
1 parent 5954553 commit 4575573
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/rating/rating.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,14 @@ describe('ngb-rating', () => {
expect(rating.attributes['aria-valuemax']).toBe('10');
});

it('contains aria-valuemin', () => {
const fixture = createTestComponent('<ngb-rating [max]="max"></ngb-rating>');

const rating = fixture.debugElement.query(By.directive(NgbRating));

expect(rating.attributes['aria-valuemin']).toBe('0');
});

it('contains a hidden span for each star for screenreaders', () => {
const fixture = createTestComponent('<ngb-rating max="5"></ngb-rating>');

Expand Down
2 changes: 1 addition & 1 deletion src/rating/rating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const NGB_RATING_VALUE_ACCESSOR = {
'class': 'd-inline-flex',
'tabindex': '0',
'role': 'slider',
'attr.aria-valuemin': '0',
'aria-valuemin': '0',
'[attr.aria-valuemax]': 'max',
'[attr.aria-valuenow]': 'nextRate',
'[attr.aria-valuetext]': 'ariaValueText()',
Expand Down

0 comments on commit 4575573

Please sign in to comment.