From e41ba68cab1a157063a785301a1605ae14725fff Mon Sep 17 00:00:00 2001 From: Erin Doyle Date: Mon, 24 Apr 2017 18:09:23 -0400 Subject: [PATCH] Fixed #11 from being too strict testing for use-onblur-not-onchange. Now it should pass if onChange is used in addition to onBlur. --- src/rules/use-onblur-not-onchange.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rules/use-onblur-not-onchange.js b/src/rules/use-onblur-not-onchange.js index 61e1534..2d92854 100644 --- a/src/rules/use-onblur-not-onchange.js +++ b/src/rules/use-onblur-not-onchange.js @@ -19,8 +19,9 @@ export default [{ const disabled = trueish(props, 'aria-disabled'); const readOnly = trueish(props, 'aria-readonly'); const onChange = listensTo(props, 'onChange'); + const onBlur = listensTo(props, 'onBlur'); - return hidden || disabled || readOnly || !onChange; + return hidden || disabled || readOnly || !onChange || (onChange && onBlur); } }]; @@ -37,10 +38,13 @@ export const pass = [{ }, { when: 'the element is aria-readonly', render: React => +}, { + when: 'the `onChange` prop is present along with an `onBlur` prop', + render: React => }]; export const fail = [{ - when: 'the `onChange` prop is present', + when: 'the `onChange` prop is present without an `onBlur` prop', render: React => }];