Skip to content

Commit f267e2d

Browse files
committed
Merge pull request #30 from rackt/fix-assertions
Tidy up assertions and tests
2 parents b6f1d81 + 6851277 commit f267e2d

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

lib/__tests__/index-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ describe('props', () => {
9898
});
9999

100100
describe('when role="button"', () => {
101-
it('requires onKeyUp', () => {
101+
it('requires onKeyDown', () => {
102102
expectWarning(assertions.props.onClick.BUTTON_ROLE_SPACE.msg, () => {
103103
<span onClick={k} role="button"/>;
104104
});

lib/assertions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ exports.props = {
6868
}
6969
},
7070

71-
// onKeyUp is too late to cancel space's default behavior of scrolling the
72-
// page.
7371
BUTTON_ROLE_SPACE: {
7472
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.',
7573
test (tagName, props, children) {
@@ -80,7 +78,7 @@ exports.props = {
8078
BUTTON_ROLE_ENTER: {
8179
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.',
8280
test (tagName, props, children) {
83-
return !(props.role === 'button' && props.onKeyDown);
81+
return !(props.role === 'button' && !props.onKeyDown);
8482
}
8583
}
8684

0 commit comments

Comments
 (0)