diff --git a/lib/__tests__/index-test.js b/lib/__tests__/index-test.js index bc6dbaa..90baa91 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 d7ff51b..1dd4a86 100644 --- a/lib/index.js +++ b/lib/index.js @@ -11,6 +11,7 @@ var assertAccessibility = (tagName, props, children, log) => { var propTests; for (var propName in props) { + if (props[propName] === null || props[propName] === undefined) continue; propTests = assertions.props[propName]; if (propTests) for (key in propTests) @@ -39,4 +40,3 @@ module.exports = (options) => { return _createElement.apply(this, arguments); }; }; -