Skip to content

Commit e41ba68

Browse files
author
Erin Doyle
committed
Fixed #11 from being too strict testing for use-onblur-not-onchange. Now it should pass if onChange is used in addition to onBlur.
1 parent f3fdef5 commit e41ba68

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/rules/use-onblur-not-onchange.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ export default [{
1919
const disabled = trueish(props, 'aria-disabled');
2020
const readOnly = trueish(props, 'aria-readonly');
2121
const onChange = listensTo(props, 'onChange');
22+
const onBlur = listensTo(props, 'onBlur');
2223

23-
return hidden || disabled || readOnly || !onChange;
24+
return hidden || disabled || readOnly || !onChange || (onChange && onBlur);
2425
}
2526
}];
2627

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

4246
export const fail = [{
43-
when: 'the `onChange` prop is present',
47+
when: 'the `onChange` prop is present without an `onBlur` prop',
4448
render: React => <input onChange={fn} />
4549
}];
4650

0 commit comments

Comments
 (0)