From e8de1b23ff407d9a265aefe40920847b0d292a1a Mon Sep 17 00:00:00 2001 From: Todd Kloots Date: Wed, 13 May 2015 09:01:26 -0700 Subject: [PATCH 1/2] Tidy up assertions and tests --- lib/__tests__/index-test.js | 2 +- lib/assertions.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/__tests__/index-test.js b/lib/__tests__/index-test.js index 4c684ef..de14b21 100644 --- a/lib/__tests__/index-test.js +++ b/lib/__tests__/index-test.js @@ -98,7 +98,7 @@ describe('props', () => { }); describe('when role="button"', () => { - it('requires onKeyUp', () => { + it('requires onKeyDown', () => { expectWarning(assertions.props.onClick.BUTTON_ROLE_SPACE.msg, () => { ; }); diff --git a/lib/assertions.js b/lib/assertions.js index 3adede5..080447e 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -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) { From 68512777f458e45ca926b8c1f6bd4d9cf8c022c3 Mon Sep 17 00:00:00 2001 From: Todd Kloots Date: Wed, 13 May 2015 09:42:43 -0700 Subject: [PATCH 2/2] Fix failing tests --- lib/assertions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/assertions.js b/lib/assertions.js index 080447e..9d75695 100644 --- a/lib/assertions.js +++ b/lib/assertions.js @@ -78,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); } }