yeet
This commit is contained in:
50
node_modules/react-native/Libraries/Utilities/__mocks__/BackHandler.js
generated
vendored
Normal file
50
node_modules/react-native/Libraries/Utilities/__mocks__/BackHandler.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const _backPressSubscriptions = new Set();
|
||||
|
||||
const BackHandler = {
|
||||
exitApp: jest.fn(),
|
||||
|
||||
addEventListener: function(
|
||||
eventName: BackPressEventName,
|
||||
handler: Function,
|
||||
): {remove: () => void} {
|
||||
_backPressSubscriptions.add(handler);
|
||||
return {
|
||||
remove: () => BackHandler.removeEventListener(eventName, handler),
|
||||
};
|
||||
},
|
||||
|
||||
removeEventListener: function(
|
||||
eventName: BackPressEventName,
|
||||
handler: Function,
|
||||
): void {
|
||||
_backPressSubscriptions.delete(handler);
|
||||
},
|
||||
|
||||
mockPressBack: function() {
|
||||
let invokeDefault = true;
|
||||
const subscriptions = [..._backPressSubscriptions].reverse();
|
||||
for (let i = 0; i < subscriptions.length; ++i) {
|
||||
if (subscriptions[i]()) {
|
||||
invokeDefault = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (invokeDefault) {
|
||||
BackHandler.exitApp();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = BackHandler;
|
16
node_modules/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js
generated
vendored
Normal file
16
node_modules/react-native/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const GlobalPerformanceLogger = jest
|
||||
.unmock('../createPerformanceLogger')
|
||||
.genMockFromModule('../GlobalPerformanceLogger');
|
||||
|
||||
module.exports = GlobalPerformanceLogger;
|
25
node_modules/react-native/Libraries/Utilities/__mocks__/PixelRatio.js
generated
vendored
Normal file
25
node_modules/react-native/Libraries/Utilities/__mocks__/PixelRatio.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const PixelRatio = {
|
||||
get: jest.fn().mockReturnValue(2),
|
||||
getFontScale: jest.fn(() => PixelRatio.get()),
|
||||
getPixelSizeForLayoutSize: jest.fn(layoutSize =>
|
||||
Math.round(layoutSize * PixelRatio.get()),
|
||||
),
|
||||
roundToNearestPixel: jest.fn(layoutSize => {
|
||||
const ratio = PixelRatio.get();
|
||||
return Math.round(layoutSize * ratio) / ratio;
|
||||
}),
|
||||
startDetecting: jest.fn(),
|
||||
};
|
||||
|
||||
module.exports = PixelRatio;
|
Reference in New Issue
Block a user