Skip to content

Commit

Permalink
Fixed #11 from being too strict testing for use-onblur-not-onchange. …
Browse files Browse the repository at this point in the history
…Now it should pass if onChange is used in addition to onBlur.
  • Loading branch information
Erin Doyle committed Apr 24, 2017
1 parent f3fdef5 commit e41ba68
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rules/use-onblur-not-onchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}];

Expand All @@ -37,10 +38,13 @@ export const pass = [{
}, {
when: 'the element is aria-readonly',
render: React => <input onChange={fn} aria-readonly />
}, {
when: 'the `onChange` prop is present along with an `onBlur` prop',
render: React => <input onChange={fn} onBlur={fn} />
}];

export const fail = [{
when: 'the `onChange` prop is present',
when: 'the `onChange` prop is present without an `onBlur` prop',
render: React => <input onChange={fn} />
}];

Expand Down

0 comments on commit e41ba68

Please sign in to comment.