mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Move responder tests and remove dead code (#19226)
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
// Note: ideally these would be imported from DOMTopLevelEventTypes,
|
||||
// but our build system currently doesn't let us do that from a fork.
|
||||
|
||||
export const TOP_TOUCH_START = 'touchstart';
|
||||
export const TOP_TOUCH_MOVE = 'touchmove';
|
||||
export const TOP_TOUCH_END = 'touchend';
|
||||
export const TOP_TOUCH_CANCEL = 'touchcancel';
|
||||
export const TOP_SCROLL = 'scroll';
|
||||
export const TOP_SELECTION_CHANGE = 'selectionchange';
|
||||
export const TOP_MOUSE_DOWN = 'mousedown';
|
||||
export const TOP_MOUSE_MOVE = 'mousemove';
|
||||
export const TOP_MOUSE_UP = 'mouseup';
|
||||
|
||||
export function isStartish(topLevelType: mixed): boolean {
|
||||
return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
|
||||
}
|
||||
|
||||
export function isMoveish(topLevelType: mixed): boolean {
|
||||
return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
|
||||
}
|
||||
|
||||
export function isEndish(topLevelType: mixed): boolean {
|
||||
return (
|
||||
topLevelType === TOP_TOUCH_END ||
|
||||
topLevelType === TOP_TOUCH_CANCEL ||
|
||||
topLevelType === TOP_MOUSE_UP
|
||||
);
|
||||
}
|
||||
|
||||
export const startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
|
||||
export const moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
|
||||
export const endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
|
||||
+4
-1
@@ -9,6 +9,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
// This test is a hot mess. It heavily uses internals and relies on DOM even
|
||||
// though the responder plugin is only used in React Native. Sadness ensues.
|
||||
// The coverage is valuable though, so we will keep it for now.
|
||||
const {HostComponent} = require('react-reconciler/src/ReactWorkTags');
|
||||
const {PLUGIN_EVENT_SYSTEM} = require('react-dom/src/events/EventSystemFlags');
|
||||
|
||||
@@ -1379,7 +1382,7 @@ describe('ResponderEventPlugin', () => {
|
||||
const ReactTestUtils = require('react-dom/test-utils');
|
||||
const getLowestCommonAncestor = require('legacy-events/ResponderEventPlugin')
|
||||
.getLowestCommonAncestor;
|
||||
const ReactDOMComponentTree = require('../../react-dom/src/client/ReactDOMComponentTree');
|
||||
const ReactDOMComponentTree = require('react-dom/src/client/ReactDOMComponentTree');
|
||||
|
||||
class ChildComponent extends React.Component {
|
||||
render() {
|
||||
@@ -481,14 +481,6 @@ const forks = Object.freeze({
|
||||
return null;
|
||||
}
|
||||
},
|
||||
|
||||
// React DOM uses different top level event names and supports mouse events.
|
||||
'legacy-events/ResponderTopLevelEventTypes': (bundleType, entry) => {
|
||||
if (entry === 'react-dom' || entry.startsWith('react-dom/')) {
|
||||
return 'legacy-events/forks/ResponderTopLevelEventTypes.dom.js';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = forks;
|
||||
|
||||
Reference in New Issue
Block a user