From d745f7f6b7fabef9e4319fe5b7b967b44827d256 Mon Sep 17 00:00:00 2001 From: Asa Ayers Date: Thu, 19 Mar 2015 11:41:32 -0400 Subject: [PATCH 1/2] Skip processing props that are null or undefined Conflicts: lib/index.js --- lib/__tests__/index-test.js | 12 ++++++++++++ lib/index.js | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) 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..6a4111b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -11,6 +11,8 @@ var assertAccessibility = (tagName, props, children, log) => { var propTests; for (var propName in props) { + // There's no need to check props that are null or undefined. + if (props[propName] === null || props[propName] === undefined) continue; propTests = assertions.props[propName]; if (propTests) for (key in propTests) @@ -39,4 +41,3 @@ module.exports = (options) => { return _createElement.apply(this, arguments); }; }; - From 026d59617c86b4a094b4d2eaf0af65c5c08c842a Mon Sep 17 00:00:00 2001 From: Asa Ayers Date: Thu, 19 Mar 2015 11:52:32 -0400 Subject: [PATCH 2/2] Removing my comment --- lib/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 6a4111b..1dd4a86 100644 --- a/lib/index.js +++ b/lib/index.js @@ -11,7 +11,6 @@ var assertAccessibility = (tagName, props, children, log) => { var propTests; for (var propName in props) { - // There's no need to check props that are null or undefined. if (props[propName] === null || props[propName] === undefined) continue; propTests = assertions.props[propName]; if (propTests)