Skip to content

Commit

Permalink
Added more specific warning for using onDblClick instead of onDoubleC…
Browse files Browse the repository at this point in the history
…lick (facebook#6881)
  • Loading branch information
natenorberg authored and jimfb committed May 27, 2016
1 parent ba3bfe3 commit 38900cc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
5 changes: 5 additions & 0 deletions src/renderers/shared/stack/event/EventPluginRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ function publishRegistrationName(registrationName, PluginModule, eventName) {
var lowerCasedName = registrationName.toLowerCase();
EventPluginRegistry.possibleRegistrationNames[lowerCasedName] =
registrationName;


if (registrationName === 'onDoubleClick') {
EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
}
}
}

Expand Down

0 comments on commit 38900cc

Please sign in to comment.