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 (#6881)

(cherry picked from commit 38900cc)
  • Loading branch information
natenorberg authored and zpao committed Jun 14, 2016
1 parent a5d7fc8 commit 3d748e9
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 @@ -161,6 +161,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 3d748e9

Please sign in to comment.