EventPluginRegistry-test.internal.js — react Source File
Architecture documentation for EventPluginRegistry-test.internal.js, a javascript file in the react codebase.
Entity Profile
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @emails react-core
*/
'use strict';
describe('EventPluginRegistry', () => {
let EventPluginRegistry;
let createPlugin;
beforeEach(() => {
jest.resetModules();
// These tests are intentionally testing the private injection interface.
// The public API surface of this is covered by other tests so
// if `EventPluginRegistry` is ever deleted, these tests should be
// safe to remove too.
EventPluginRegistry = require('react-native-renderer/src/legacy-events/EventPluginRegistry');
createPlugin = function (properties) {
return Object.assign({extractEvents: function () {}}, properties);
};
});
it('should be able to inject ordering before plugins', () => {
const OnePlugin = createPlugin();
const TwoPlugin = createPlugin();
const ThreePlugin = createPlugin();
EventPluginRegistry.injectEventPluginOrder(['one', 'two', 'three']);
EventPluginRegistry.injectEventPluginsByName({
one: OnePlugin,
two: TwoPlugin,
});
EventPluginRegistry.injectEventPluginsByName({
three: ThreePlugin,
});
expect(EventPluginRegistry.plugins.length).toBe(3);
expect(EventPluginRegistry.plugins[0]).toBe(OnePlugin);
expect(EventPluginRegistry.plugins[1]).toBe(TwoPlugin);
expect(EventPluginRegistry.plugins[2]).toBe(ThreePlugin);
});
it('should be able to inject plugins before and after ordering', () => {
const OnePlugin = createPlugin();
const TwoPlugin = createPlugin();
const ThreePlugin = createPlugin();
EventPluginRegistry.injectEventPluginsByName({
one: OnePlugin,
two: TwoPlugin,
});
EventPluginRegistry.injectEventPluginOrder(['one', 'two', 'three']);
EventPluginRegistry.injectEventPluginsByName({
three: ThreePlugin,
// ... (178 more lines)
Source
Frequently Asked Questions
What does EventPluginRegistry-test.internal.js do?
EventPluginRegistry-test.internal.js is a source file in the react codebase, written in javascript.
Where is EventPluginRegistry-test.internal.js in the architecture?
EventPluginRegistry-test.internal.js is located at packages/react-native-renderer/src/__tests__/EventPluginRegistry-test.internal.js (directory: packages/react-native-renderer/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free