Skip to content

Commit

Permalink
fix(BreadcrumbItem): Add 'aria-current' attribute (reactstrap#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
gergely-nagy committed Nov 19, 2017
1 parent 7d5ec13 commit 644c18e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/BreadcrumbItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const BreadcrumbItem = (props) => {
), cssModule);

return (
<Tag {...attributes} className={classes} />
<Tag
{...attributes}
className={classes}
aria-current={active ? 'page' : undefined}
/>
);
};

Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/BreadcrumbList.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ describe('BreadcrumbItem', () => {
const wrapper = shallow(<BreadcrumbItem>Default BreadcrumbItem</BreadcrumbItem>);

expect(wrapper.hasClass('active')).toBe(false);
expect(wrapper.prop('aria-current')).toBe(undefined);
});

it('should render with the "active" class when the avtive prop is truthy', () => {
const wrapper = shallow(<BreadcrumbItem active>Default BreadcrumbItem</BreadcrumbItem>);

expect(wrapper.hasClass('active')).toBe(true);
expect(wrapper.prop('aria-current')).toBe('page');
});

it('should render custom tag', () => {
Expand Down

0 comments on commit 644c18e

Please sign in to comment.