Skip to content

Commit

Permalink
set aria-disabled attribute when day is disabled (Hacker0x01#1880)
Browse files Browse the repository at this point in the history
  • Loading branch information
thijskramer authored and martijnrusschen committed Aug 29, 2019
1 parent de392f6 commit 73fbd48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/day.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export default class Day extends React.Component {
onMouseEnter={this.handleMouseEnter}
aria-label={`day-${getDate(this.props.day)}`}
role="option"
aria-disabled={this.isDisabled()}
>
{this.props.renderDayContents
? this.props.renderDayContents(
Expand Down
11 changes: 11 additions & 0 deletions test/day_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,17 @@ describe("Day", () => {
const shallowDay = renderDay(day, { excludeDates: [day] });
expect(shallowDay.hasClass(className)).to.equal(true);
});

it("should have aria-disabled attribute with true value if date is disabled", () => {
const day = newDate();
const shallowDay = renderDay(day, { excludeDates: [day] });
expect(shallowDay.prop("aria-disabled")).to.equal(true);
});

it("should have aria-disabled attribute with false value if date is not disabled", () => {
const shallowDay = renderDay(newDate());
expect(shallowDay.prop("aria-disabled")).to.equal(false);
});
});

describe("click", () => {
Expand Down

0 comments on commit 73fbd48

Please sign in to comment.