@samitouri / QOS-React / commits / 38900cc7ca

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

Nate Norberg committed May 27, 2016 at 16:23 UTC 38900cc7cad8906c19515c78fd082637c2046fbd
2 files changed +16
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+11
@@ -163,6 +163,17 @@ describe('ReactDOMComponent', function() {
163 );
164 });
165
166 + it('should warn for onDblClick prop', function() {
167 + spyOn(console, 'error');
168 + var container = document.createElement('div');
169 + ReactDOM.render(<div onDblClick={() => {}} />, container);
170 + expect(console.error.calls.count(0)).toBe(1);
171 + expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
172 + 'Warning: Unknown event handler property onDblClick. Did you mean `onDoubleClick`?\n in div (at **)'
173 + );
174 + });
175 +
176 +
177 it('should warn about styles with numeric string values for non-unitless properties', function() {
178 spyOn(console, 'error');
179
src/renderers/shared/stack/event/EventPluginRegistry.js
+5
@@ -132,6 +132,11 @@ function publishRegistrationName(registrationName, PluginModule, eventName) {
132 var lowerCasedName = registrationName.toLowerCase();
133 EventPluginRegistry.possibleRegistrationNames[lowerCasedName] =
134 registrationName;
135 +
136 +
137 + if (registrationName === 'onDoubleClick') {
138 + EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
139 + }
140 }
141 }
142