diff --git a/lib/__tests__/index-test.js b/lib/__tests__/index-test.js index 76d1c9e..5a1be9e 100644 --- a/lib/__tests__/index-test.js +++ b/lib/__tests__/index-test.js @@ -35,6 +35,18 @@ describe('props', () => { }); }); + it('does not warn if onClick is null', () => { + doNotExpectWarning(assertions.props.onClick.NO_LABEL.msg, () => { +
; + }); + }); + + it('does not warn if onClick is undefined', () => { + doNotExpectWarning(assertions.props.onClick.NO_LABEL.msg, () => { +
; + }); + }); + it('does not warn if there is an aria-label', () => { doNotExpectWarning(assertions.props.onClick.NO_LABEL.msg, () => {
; diff --git a/lib/index.js b/lib/index.js index f1e136b..8ca8432 100644 --- a/lib/index.js +++ b/lib/index.js @@ -12,6 +12,7 @@ var assertAccessibility = (tagName, props, children) => { var propTests; for (var propName in props) { + if (props[propName] === null || props[propName] === undefined) continue; propTests = assertions.props[propName] || []; for (key in propTests) if (propTests[key] && !propTests[key].test(tagName, props, children))