Added more specific warning for using onDblClick instead of onDoubleClick (#6881)

This commit is contained in:
Nate Norberg
2016-05-27 15:23:05 -07:00
committed by Jim
parent af4f0171ea
commit 7db3733fce
2 changed files with 16 additions and 0 deletions
@@ -163,6 +163,17 @@ describe('ReactDOMComponent', function() {
);
});
it('should warn for onDblClick prop', function() {
spyOn(console, 'error');
var container = document.createElement('div');
ReactDOM.render(<div onDblClick={() => {}} />, container);
expect(console.error.calls.count(0)).toBe(1);
expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Unknown event handler property onDblClick. Did you mean `onDoubleClick`?\n in div (at **)'
);
});
it('should warn about styles with numeric string values for non-unitless properties', function() {
spyOn(console, 'error');
@@ -132,6 +132,11 @@ function publishRegistrationName(registrationName, PluginModule, eventName) {
var lowerCasedName = registrationName.toLowerCase();
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] =
registrationName;
if (registrationName === 'onDoubleClick') {
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
}
}
}