@samitouri / QOS-React-2 / commits / b231445f96

Move responder tests and remove dead code (#19226)

Dan Abramov committed Jul 1, 2020 at 16:20 UTC b231445f969709fe2da1e66cbc2630c314a16807
4 files changed +4 -50
packages/legacy-events/forks/ResponderTopLevelEventTypes.dom.js deleted
-41
@@ -1,41 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - *
7 - * @flow
8 - */
9 -
10 -// Note: ideally these would be imported from DOMTopLevelEventTypes,
11 -// but our build system currently doesn't let us do that from a fork.
12 -
13 -export const TOP_TOUCH_START = 'touchstart';
14 -export const TOP_TOUCH_MOVE = 'touchmove';
15 -export const TOP_TOUCH_END = 'touchend';
16 -export const TOP_TOUCH_CANCEL = 'touchcancel';
17 -export const TOP_SCROLL = 'scroll';
18 -export const TOP_SELECTION_CHANGE = 'selectionchange';
19 -export const TOP_MOUSE_DOWN = 'mousedown';
20 -export const TOP_MOUSE_MOVE = 'mousemove';
21 -export const TOP_MOUSE_UP = 'mouseup';
22 -
23 -export function isStartish(topLevelType: mixed): boolean {
24 - return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
25 -}
26 -
27 -export function isMoveish(topLevelType: mixed): boolean {
28 - return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
29 -}
30 -
31 -export function isEndish(topLevelType: mixed): boolean {
32 - return (
33 - topLevelType === TOP_TOUCH_END ||
34 - topLevelType === TOP_TOUCH_CANCEL ||
35 - topLevelType === TOP_MOUSE_UP
36 - );
37 -}
38 -
39 -export const startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
40 -export const moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
41 -export const endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
packages/react-native-renderer/src/__tests__/EventPluginRegistry-test.internal.js renamed
packages/react-native-renderer/src/__tests__/ResponderEventPlugin-test.internal.js renamed
+4 -1
@@ -9,6 +9,9 @@
9
10 'use strict';
11
12 +// This test is a hot mess. It heavily uses internals and relies on DOM even
13 +// though the responder plugin is only used in React Native. Sadness ensues.
14 +// The coverage is valuable though, so we will keep it for now.
15 const {HostComponent} = require('react-reconciler/src/ReactWorkTags');
16 const {PLUGIN_EVENT_SYSTEM} = require('react-dom/src/events/EventSystemFlags');
17
@@ -1379,7 +1382,7 @@ describe('ResponderEventPlugin', () => {
1382 const ReactTestUtils = require('react-dom/test-utils');
1383 const getLowestCommonAncestor = require('legacy-events/ResponderEventPlugin')
1384 .getLowestCommonAncestor;
1382 - const ReactDOMComponentTree = require('../../react-dom/src/client/ReactDOMComponentTree');
1385 + const ReactDOMComponentTree = require('react-dom/src/client/ReactDOMComponentTree');
1386
1387 class ChildComponent extends React.Component {
1388 render() {
scripts/rollup/forks.js
-8
@@ -481,14 +481,6 @@ const forks = Object.freeze({
481 return null;
482 }
483 },
484 -
485 - // React DOM uses different top level event names and supports mouse events.
486 - 'legacy-events/ResponderTopLevelEventTypes': (bundleType, entry) => {
487 - if (entry === 'react-dom' || entry.startsWith('react-dom/')) {
488 - return 'legacy-events/forks/ResponderTopLevelEventTypes.dom.js';
489 - }
490 - return null;
491 - },
484 });
485
486 module.exports = forks;