Remove EventPluginRegistry.getPluginModuleForEvent (#9110)
Brandon Dail committed
Mar 6, 2017 at 00:52 UTC
12ad77d00635b8dfa6d491207688acb9cd4b25bc
3 files changed
-73
scripts/fiber/tests-passing.txt
-1
@@ -1641,7 +1641,6 @@ src/renderers/shared/shared/event/__tests__/EventPluginRegistry-test.js
1641
* should publish registration names of injected plugins
1642
* should throw if multiple registration names collide
1643
* should throw if an invalid event is published
1644
-* should be able to get the plugin from synthetic events
1644
1645
src/renderers/shared/shared/event/eventPlugins/__tests__/ResponderEventPlugin-test.js
1646
* should do nothing when no one wants to respond
src/renderers/shared/shared/event/EventPluginRegistry.js
-36
@@ -14,7 +14,6 @@
14
15
import type {
16
DispatchConfig,
17
- ReactSyntheticEvent,
17
} from 'ReactSyntheticEventType';
18
19
import type {
@@ -257,41 +256,6 @@ var EventPluginRegistry = {
256
}
257
},
258
260
- /**
261
- * Looks up the plugin for the supplied event.
262
- *
263
- * @param {object} event A synthetic event.
264
- * @return {?object} The plugin that created the supplied event.
265
- * @internal
266
- */
267
- getPluginModuleForEvent: function(
268
- event: ReactSyntheticEvent,
269
- ): null | PluginModule<AnyNativeEvent> {
270
- var dispatchConfig = event.dispatchConfig;
271
- if (dispatchConfig.registrationName) {
272
- return EventPluginRegistry.registrationNameModules[
273
- dispatchConfig.registrationName
274
- ] || null;
275
- }
276
- if (dispatchConfig.phasedRegistrationNames !== undefined) {
277
- // pulling phasedRegistrationNames out of dispatchConfig helps Flow see
278
- // that it is not undefined.
279
- var {phasedRegistrationNames} = dispatchConfig;
280
- for (var phase in phasedRegistrationNames) {
281
- if (!phasedRegistrationNames.hasOwnProperty(phase)) {
282
- continue;
283
- }
284
- var pluginModule = EventPluginRegistry.registrationNameModules[
285
- phasedRegistrationNames[phase]
286
- ];
287
- if (pluginModule) {
288
- return pluginModule;
289
- }
290
- }
291
- }
292
- return null;
293
- },
294
-
259
/**
260
* Exposed for unit testing.
261
* @private
src/renderers/shared/shared/event/__tests__/EventPluginRegistry-test.js
-36
@@ -225,40 +225,4 @@ describe('EventPluginRegistry', () => {
225
'`one`.'
226
);
227
});
228
-
229
- it('should be able to get the plugin from synthetic events', () => {
230
- var clickDispatchConfig = {
231
- registrationName: 'onClick',
232
- };
233
- var magicDispatchConfig = {
234
- phasedRegistrationNames: {
235
- bubbled: 'onMagicBubble',
236
- captured: 'onMagicCapture',
237
- },
238
- };
239
-
240
- var OnePlugin = createPlugin({
241
- eventTypes: {
242
- click: clickDispatchConfig,
243
- magic: magicDispatchConfig,
244
- },
245
- });
246
-
247
- var clickEvent = {dispatchConfig: clickDispatchConfig};
248
- var magicEvent = {dispatchConfig: magicDispatchConfig};
249
-
250
- expect(EventPluginRegistry.getPluginModuleForEvent(clickEvent)).toBe(null);
251
- expect(EventPluginRegistry.getPluginModuleForEvent(magicEvent)).toBe(null);
252
-
253
- EventPluginRegistry.injectEventPluginsByName({one: OnePlugin});
254
- EventPluginRegistry.injectEventPluginOrder(['one']);
255
-
256
- expect(
257
- EventPluginRegistry.getPluginModuleForEvent(clickEvent)
258
- ).toBe(OnePlugin);
259
- expect(
260
- EventPluginRegistry.getPluginModuleForEvent(magicEvent)
261
- ).toBe(OnePlugin);
262
- });
263
-
228
});