Skip to content

Commit

Permalink
Merge pull request reactjs#30 from rackt/fix-assertions
Browse files Browse the repository at this point in the history
Tidy up assertions and tests
  • Loading branch information
angus-c committed May 13, 2015
2 parents b6f1d81 + 6851277 commit f267e2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/__tests__/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('props', () => {
});

describe('when role="button"', () => {
it('requires onKeyUp', () => {
it('requires onKeyDown', () => {
expectWarning(assertions.props.onClick.BUTTON_ROLE_SPACE.msg, () => {
<span onClick={k} role="button"/>;
});
Expand Down
4 changes: 1 addition & 3 deletions lib/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ exports.props = {
}
},

// onKeyUp is too late to cancel space's default behavior of scrolling the
// page.
BUTTON_ROLE_SPACE: {
msg: 'You have `role="button"` but did not define an `onKeyDown` handler. Add it, and have the "Space" key do the same thing as an `onClick` handler.',
test (tagName, props, children) {
Expand All @@ -80,7 +78,7 @@ exports.props = {
BUTTON_ROLE_ENTER: {
msg: 'You have `role="button"` but did not define an `onKeyDown` handler. Add it, and have the "Enter" key do the same thing as an `onClick` handler.',
test (tagName, props, children) {
return !(props.role === 'button' && props.onKeyDown);
return !(props.role === 'button' && !props.onKeyDown);
}
}

Expand Down

0 comments on commit f267e2d

Please sign in to comment.