@tamagui/react-native-web-lite 1.125.6 → 1.125.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/AccessibilityInfo/index.native.js +58 -62
- package/dist/esm/AccessibilityInfo/index.native.js.map +1 -6
- package/dist/esm/ActivityIndicator/__tests__/index-test.native.js +85 -55
- package/dist/esm/ActivityIndicator/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/ActivityIndicator/index.native.js +82 -90
- package/dist/esm/ActivityIndicator/index.native.js.map +1 -6
- package/dist/esm/Alert/index.native.js +14 -18
- package/dist/esm/Alert/index.native.js.map +1 -6
- package/dist/esm/AppRegistry/AppContainer.native.js +30 -26
- package/dist/esm/AppRegistry/AppContainer.native.js.map +1 -6
- package/dist/esm/AppRegistry/__tests__/index-test.native.js +13 -13
- package/dist/esm/AppRegistry/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/AppRegistry/__tests__/index-test.node.native.js +45 -34
- package/dist/esm/AppRegistry/__tests__/index-test.node.native.js.map +1 -6
- package/dist/esm/AppRegistry/index.native.js +50 -55
- package/dist/esm/AppRegistry/index.native.js.map +1 -6
- package/dist/esm/AppRegistry/renderApplication.native.js +33 -27
- package/dist/esm/AppRegistry/renderApplication.native.js.map +1 -6
- package/dist/esm/AppState/__tests__/index-test.native.js +9 -10
- package/dist/esm/AppState/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/AppState/index.native.js +45 -51
- package/dist/esm/AppState/index.native.js.map +1 -6
- package/dist/esm/Appearance/index.native.js +27 -24
- package/dist/esm/Appearance/index.native.js.map +1 -6
- package/dist/esm/BackHandler/index.native.js +11 -13
- package/dist/esm/BackHandler/index.native.js.map +1 -6
- package/dist/esm/Batchinator/index.native.js +19 -23
- package/dist/esm/Batchinator/index.native.js.map +1 -6
- package/dist/esm/Clipboard/index.native.js +21 -26
- package/dist/esm/Clipboard/index.native.js.map +1 -6
- package/dist/esm/DeviceEmitter.native.js +3 -5
- package/dist/esm/DeviceEmitter.native.js.map +1 -6
- package/dist/esm/DeviceInfo/index.native.js +41 -33
- package/dist/esm/DeviceInfo/index.native.js.map +1 -6
- package/dist/esm/Dimensions/__tests__/index-test.native.js +9 -8
- package/dist/esm/Dimensions/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/Dimensions/index.native.js +49 -53
- package/dist/esm/Dimensions/index.native.js.map +1 -6
- package/dist/esm/FlatList.native.js +137 -131
- package/dist/esm/FlatList.native.js.map +1 -6
- package/dist/esm/I18nManager/index.native.js +10 -13
- package/dist/esm/I18nManager/index.native.js.map +1 -6
- package/dist/esm/Image/index.native.js +174 -149
- package/dist/esm/Image/index.native.js.map +1 -6
- package/dist/esm/Image/types.native.js +2 -1
- package/dist/esm/Image/types.native.js.map +1 -6
- package/dist/esm/ImageBackground/__tests__/index-test.native.js +27 -19
- package/dist/esm/ImageBackground/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/ImageBackground/index.native.js +35 -33
- package/dist/esm/ImageBackground/index.native.js.map +1 -6
- package/dist/esm/InteractionManager/TaskQueue.native.js +46 -51
- package/dist/esm/InteractionManager/TaskQueue.native.js.map +1 -6
- package/dist/esm/InteractionManager/index.native.js +66 -60
- package/dist/esm/InteractionManager/index.native.js.map +1 -6
- package/dist/esm/Keyboard/index.native.js +13 -17
- package/dist/esm/Keyboard/index.native.js.map +1 -6
- package/dist/esm/KeyboardAvoidingView/index.native.js +34 -44
- package/dist/esm/KeyboardAvoidingView/index.native.js.map +1 -6
- package/dist/esm/Linking/__tests__/index-test.native.js +9 -9
- package/dist/esm/Linking/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/Linking/index.native.js +42 -49
- package/dist/esm/Linking/index.native.js.map +1 -6
- package/dist/esm/LogBox/index.native.js +7 -12
- package/dist/esm/LogBox/index.native.js.map +1 -6
- package/dist/esm/Modal/ModalAnimation.native.js +89 -112
- package/dist/esm/Modal/ModalAnimation.native.js.map +1 -6
- package/dist/esm/Modal/ModalContent.native.js +52 -54
- package/dist/esm/Modal/ModalContent.native.js.map +1 -6
- package/dist/esm/Modal/ModalFocusTrap.native.js +49 -52
- package/dist/esm/Modal/ModalFocusTrap.native.js.map +1 -6
- package/dist/esm/Modal/ModalPortal.native.js +9 -11
- package/dist/esm/Modal/ModalPortal.native.js.map +1 -6
- package/dist/esm/Modal/index.native.js +53 -45
- package/dist/esm/Modal/index.native.js.map +1 -6
- package/dist/esm/NativeModules/index.native.js +5 -6
- package/dist/esm/NativeModules/index.native.js.map +1 -6
- package/dist/esm/PanResponder/Alternative.js +157 -122
- package/dist/esm/PanResponder/Alternative.js.map +1 -6
- package/dist/esm/PanResponder/index.native.js +3 -5
- package/dist/esm/PanResponder/index.native.js.map +1 -6
- package/dist/esm/PixelRatio/index.native.js +48 -59
- package/dist/esm/PixelRatio/index.native.js.map +1 -6
- package/dist/esm/Pressable/index.native.js +70 -67
- package/dist/esm/Pressable/index.native.js.map +1 -6
- package/dist/esm/RefreshControl/index.native.js +4 -6
- package/dist/esm/RefreshControl/index.native.js.map +1 -6
- package/dist/esm/SafeAreaView/index.native.js +24 -21
- package/dist/esm/SafeAreaView/index.native.js.map +1 -6
- package/dist/esm/ScrollView/ScrollViewBase.native.js +61 -50
- package/dist/esm/ScrollView/ScrollViewBase.native.js.map +1 -6
- package/dist/esm/ScrollView/index.native.js +183 -211
- package/dist/esm/ScrollView/index.native.js.map +1 -6
- package/dist/esm/Share/index.native.js +29 -36
- package/dist/esm/Share/index.native.js.map +1 -6
- package/dist/esm/StatusBar/index.native.js +3 -6
- package/dist/esm/StatusBar/index.native.js.map +1 -6
- package/dist/esm/Text/index.native.js +128 -100
- package/dist/esm/Text/index.native.js.map +1 -6
- package/dist/esm/Text/types.native.js +2 -1
- package/dist/esm/Text/types.native.js.map +1 -6
- package/dist/esm/TextInput/__tests__/index-test.native.js +445 -259
- package/dist/esm/TextInput/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/TextInput/index.native.js +210 -147
- package/dist/esm/TextInput/index.native.js.map +1 -6
- package/dist/esm/TextInput/types.native.js +2 -1
- package/dist/esm/TextInput/types.native.js.map +1 -6
- package/dist/esm/TouchableOpacity.native.js +63 -67
- package/dist/esm/TouchableOpacity.native.js.map +1 -6
- package/dist/esm/TouchableWithoutFeedback.native.js +49 -45
- package/dist/esm/TouchableWithoutFeedback.native.js.map +1 -6
- package/dist/esm/UnimplementedView.native.js +22 -30
- package/dist/esm/UnimplementedView.native.js.map +1 -6
- package/dist/esm/Vibration/index.native.js +14 -14
- package/dist/esm/Vibration/index.native.js.map +1 -6
- package/dist/esm/View/index.native.js +84 -55
- package/dist/esm/View/index.native.js.map +1 -6
- package/dist/esm/View/types.native.js +2 -1
- package/dist/esm/View/types.native.js.map +1 -6
- package/dist/esm/createElement/__tests__/index-test.native.js +398 -195
- package/dist/esm/createElement/__tests__/index-test.native.js.map +1 -6
- package/dist/esm/createElement/index.native.js +18 -16
- package/dist/esm/createElement/index.native.js.map +1 -6
- package/dist/esm/createReactDOMStyle.native.js +2 -4
- package/dist/esm/createReactDOMStyle.native.js.map +1 -6
- package/dist/esm/index.native.js +47 -123
- package/dist/esm/index.native.js.map +1 -6
- package/dist/esm/render/index.native.js +6 -15
- package/dist/esm/render/index.native.js.map +1 -6
- package/dist/esm/styleTypes.native.js +2 -1
- package/dist/esm/styleTypes.native.js.map +1 -6
- package/dist/esm/types.native.js +2 -1
- package/dist/esm/types.native.js.map +1 -6
- package/dist/esm/useColorScheme/index.native.js +7 -7
- package/dist/esm/useColorScheme/index.native.js.map +1 -6
- package/dist/esm/useLocaleContext/index.native.js +2 -4
- package/dist/esm/useLocaleContext/index.native.js.map +1 -6
- package/dist/esm/useWindowDimensions/index.native.js +9 -9
- package/dist/esm/useWindowDimensions/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/Animated.native.js +16 -17
- package/dist/esm/vendor/react-native/Animated/Animated.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/AnimatedEvent.native.js +72 -99
- package/dist/esm/vendor/react-native/Animated/AnimatedEvent.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/AnimatedImplementation.native.js +465 -436
- package/dist/esm/vendor/react-native/Animated/AnimatedImplementation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/AnimatedMock.native.js +97 -91
- package/dist/esm/vendor/react-native/Animated/AnimatedMock.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/AnimatedPlatformConfig.native.js +2 -1
- package/dist/esm/vendor/react-native/Animated/AnimatedPlatformConfig.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/Easing.native.js +194 -231
- package/dist/esm/vendor/react-native/Animated/Easing.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedHelper.native.js +206 -222
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedHelper.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedModule.native.js +3 -5
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedModule.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedTurboModule.native.js +3 -5
- package/dist/esm/vendor/react-native/Animated/NativeAnimatedTurboModule.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/SpringConfig.native.js +5 -5
- package/dist/esm/vendor/react-native/Animated/SpringConfig.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/animations/Animation.native.js +25 -37
- package/dist/esm/vendor/react-native/Animated/animations/Animation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/animations/DecayAnimation.native.js +42 -54
- package/dist/esm/vendor/react-native/Animated/animations/DecayAnimation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/animations/SpringAnimation.native.js +72 -72
- package/dist/esm/vendor/react-native/Animated/animations/SpringAnimation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/animations/TimingAnimation.native.js +45 -60
- package/dist/esm/vendor/react-native/Animated/animations/TimingAnimation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/bezier.native.js +23 -20
- package/dist/esm/vendor/react-native/Animated/bezier.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedImage.native.js +4 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedImage.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedScrollView.native.js +12 -13
- package/dist/esm/vendor/react-native/Animated/components/AnimatedScrollView.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedText.native.js +4 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedText.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedView.native.js +4 -6
- package/dist/esm/vendor/react-native/Animated/components/AnimatedView.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/createAnimatedComponent.native.js +17 -11
- package/dist/esm/vendor/react-native/Animated/createAnimatedComponent.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedAddition.native.js +39 -55
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedAddition.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedColor.native.js +180 -197
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedColor.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDiffClamp.native.js +39 -51
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDiffClamp.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDivision.native.js +42 -57
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedDivision.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedInterpolation.native.js +99 -116
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedInterpolation.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedModulo.native.js +37 -50
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedModulo.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedMultiplication.native.js +39 -55
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedMultiplication.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedNode.native.js +61 -89
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedNode.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedProps.native.js +52 -70
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedProps.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedStyle.native.js +50 -68
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedStyle.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedSubtraction.native.js +39 -55
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedSubtraction.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTracking.native.js +41 -53
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTracking.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTransform.native.js +44 -57
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedTransform.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValue.native.js +70 -99
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValue.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValueXY.native.js +64 -82
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedValueXY.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedWithChildren.native.js +40 -53
- package/dist/esm/vendor/react-native/Animated/nodes/AnimatedWithChildren.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Animated/useAnimatedProps.native.js +50 -58
- package/dist/esm/vendor/react-native/Animated/useAnimatedProps.native.js.map +1 -6
- package/dist/esm/vendor/react-native/FeatureFlags.native.js +8 -10
- package/dist/esm/vendor/react-native/FeatureFlags.native.js.map +1 -6
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js +58 -59
- package/dist/esm/vendor/react-native/FillRateHelper/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.native.js +3 -5
- package/dist/esm/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.native.js.map +1 -6
- package/dist/esm/vendor/react-native/NativeEventEmitter/index.native.js +46 -55
- package/dist/esm/vendor/react-native/NativeEventEmitter/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/PanResponder/index.native.js +224 -219
- package/dist/esm/vendor/react-native/PanResponder/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/TouchHistoryMath/index.native.js +58 -81
- package/dist/esm/vendor/react-native/TouchHistoryMath/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/TurboModule/RCTExport.native.js +2 -1
- package/dist/esm/vendor/react-native/TurboModule/RCTExport.native.js.map +1 -6
- package/dist/esm/vendor/react-native/TurboModule/TurboModuleRegistry.native.js +2 -5
- package/dist/esm/vendor/react-native/TurboModule/TurboModuleRegistry.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Types/CoreEventTypes.native.js +2 -1
- package/dist/esm/vendor/react-native/Types/CoreEventTypes.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js +2 -4
- package/dist/esm/vendor/react-native/Utilities/clamp.native.js.map +1 -6
- package/dist/esm/vendor/react-native/Utilities/setAndForwardRef.native.js +5 -6
- package/dist/esm/vendor/react-native/Utilities/setAndForwardRef.native.js.map +1 -6
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js +127 -129
- package/dist/esm/vendor/react-native/ViewabilityHelper.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js +51 -50
- package/dist/esm/vendor/react-native/VirtualizeUtils/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js +60 -73
- package/dist/esm/vendor/react-native/VirtualizedList/CellRenderMask.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js +96 -96
- package/dist/esm/vendor/react-native/VirtualizedList/ChildListCollection.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js +57 -64
- package/dist/esm/vendor/react-native/VirtualizedList/StateSafePureComponent.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js +105 -117
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListCellRenderer.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js +35 -37
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListContext.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js +2 -1
- package/dist/esm/vendor/react-native/VirtualizedList/VirtualizedListProps.native.js.map +1 -6
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js +817 -760
- package/dist/esm/vendor/react-native/VirtualizedList/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js +17 -29
- package/dist/esm/vendor/react-native/deepDiffer/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/EventEmitter.native.js +3 -5
- package/dist/esm/vendor/react-native/emitter/EventEmitter.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/EventSubscription.native.js +2 -1
- package/dist/esm/vendor/react-native/emitter/EventSubscription.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/_EmitterSubscription.native.js +24 -33
- package/dist/esm/vendor/react-native/emitter/_EmitterSubscription.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/_EventEmitter.native.js +41 -51
- package/dist/esm/vendor/react-native/emitter/_EventEmitter.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/_EventSubscription.native.js +12 -16
- package/dist/esm/vendor/react-native/emitter/_EventSubscription.native.js.map +1 -6
- package/dist/esm/vendor/react-native/emitter/_EventSubscriptionVendor.native.js +21 -26
- package/dist/esm/vendor/react-native/emitter/_EventSubscriptionVendor.native.js.map +1 -6
- package/dist/esm/vendor/react-native/infoLog/index.native.js +3 -6
- package/dist/esm/vendor/react-native/infoLog/index.native.js.map +1 -6
- package/dist/esm/vendor/react-native/useRefEffect.native.js +4 -8
- package/dist/esm/vendor/react-native/useRefEffect.native.js.map +1 -6
- package/dist/esm/without-animated.native.js +51 -112
- package/dist/esm/without-animated.native.js.map +1 -6
- package/package.json +6 -6
- package/src/vendor/react-native/Animated/NativeAnimatedHelper.js +1 -1
|
@@ -10,13 +10,13 @@ function findInput(container) {
|
|
|
10
10
|
function findTextArea(container) {
|
|
11
11
|
return container.querySelector("textarea");
|
|
12
12
|
}
|
|
13
|
-
var testIfDocumentIsFocused = function(message, fn) {
|
|
14
|
-
document.hasFocus && document.hasFocus() ? test(message, fn) : test.skip(`${message} \u2013 document is not focused`, function() {
|
|
15
|
-
});
|
|
13
|
+
var testIfDocumentIsFocused = function (message, fn) {
|
|
14
|
+
document.hasFocus && document.hasFocus() ? test(message, fn) : test.skip(`${message} \u2013 document is not focused`, function () {});
|
|
16
15
|
};
|
|
17
16
|
function createEvent(type) {
|
|
18
|
-
var data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
19
|
-
|
|
17
|
+
var data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
18
|
+
event = document.createEvent("CustomEvent");
|
|
19
|
+
return event.initCustomEvent(type, !0, !0), data != null && Object.keys(data).forEach(function (key) {
|
|
20
20
|
var value = data[key];
|
|
21
21
|
key === "timeStamp" && !value || Object.defineProperty(event, key, {
|
|
22
22
|
value
|
|
@@ -24,8 +24,16 @@ function createEvent(type) {
|
|
|
24
24
|
}), event;
|
|
25
25
|
}
|
|
26
26
|
function createKeyboardEvent(type) {
|
|
27
|
-
var {
|
|
28
|
-
|
|
27
|
+
var {
|
|
28
|
+
altKey = !1,
|
|
29
|
+
ctrlKey = !1,
|
|
30
|
+
isComposing = !1,
|
|
31
|
+
key = "",
|
|
32
|
+
keyCode = 0,
|
|
33
|
+
metaKey = !1,
|
|
34
|
+
preventDefault = function () {},
|
|
35
|
+
shiftKey = !1
|
|
36
|
+
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
29
37
|
return createEvent(type, {
|
|
30
38
|
altKey,
|
|
31
39
|
ctrlKey,
|
|
@@ -40,185 +48,276 @@ function createKeyboardEvent(type) {
|
|
|
40
48
|
function keydown(payload) {
|
|
41
49
|
return createKeyboardEvent("keydown", payload);
|
|
42
50
|
}
|
|
43
|
-
describe("components/TextInput", function() {
|
|
44
|
-
describe('prop "autoComplete"', function() {
|
|
45
|
-
test('value "on"', function() {
|
|
46
|
-
var {
|
|
51
|
+
describe("components/TextInput", function () {
|
|
52
|
+
describe('prop "autoComplete"', function () {
|
|
53
|
+
test('value "on"', function () {
|
|
54
|
+
var {
|
|
55
|
+
container
|
|
56
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
57
|
+
input = findInput(container);
|
|
47
58
|
expect(input.getAttribute("autoComplete")).toEqual("on");
|
|
48
|
-
}), test('value "off"', function() {
|
|
49
|
-
var {
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
}), test('value "off"', function () {
|
|
60
|
+
var {
|
|
61
|
+
container
|
|
62
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
63
|
+
autoComplete: "off"
|
|
64
|
+
})),
|
|
65
|
+
input = findInput(container);
|
|
52
66
|
expect(input.getAttribute("autoComplete")).toEqual("off");
|
|
53
|
-
}), test("autoCompleteType fallback", function() {
|
|
54
|
-
var {
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
}), test("autoCompleteType fallback", function () {
|
|
68
|
+
var {
|
|
69
|
+
container
|
|
70
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
71
|
+
autoCompleteType: "off"
|
|
72
|
+
})),
|
|
73
|
+
input = findInput(container);
|
|
57
74
|
expect(input.getAttribute("autoComplete")).toEqual("off");
|
|
58
75
|
});
|
|
59
|
-
}), describe('prop "autoFocus"', function() {
|
|
60
|
-
test('value "false"', function() {
|
|
61
|
-
var {
|
|
76
|
+
}), describe('prop "autoFocus"', function () {
|
|
77
|
+
test('value "false"', function () {
|
|
78
|
+
var {
|
|
79
|
+
container
|
|
80
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
81
|
+
input = findInput(container);
|
|
62
82
|
expect(document.activeElement).not.toBe(input);
|
|
63
|
-
}), test('value "true"', function() {
|
|
64
|
-
var {
|
|
65
|
-
|
|
66
|
-
|
|
83
|
+
}), test('value "true"', function () {
|
|
84
|
+
var {
|
|
85
|
+
container
|
|
86
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
87
|
+
autoFocus: !0
|
|
88
|
+
})),
|
|
89
|
+
input = findInput(container);
|
|
67
90
|
expect(document.activeElement).toBe(input);
|
|
68
91
|
});
|
|
69
|
-
}), describe('prop "clearTextOnFocus"', function() {
|
|
92
|
+
}), describe('prop "clearTextOnFocus"', function () {
|
|
70
93
|
var defaultValue = "defaultValue";
|
|
71
|
-
testIfDocumentIsFocused('value "false"', function() {
|
|
72
|
-
var {
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
testIfDocumentIsFocused('value "false"', function () {
|
|
95
|
+
var {
|
|
96
|
+
container
|
|
97
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
98
|
+
defaultValue
|
|
99
|
+
})),
|
|
100
|
+
input = findInput(container);
|
|
75
101
|
input.focus(), expect(input.node.value).toEqual(defaultValue);
|
|
76
|
-
}), testIfDocumentIsFocused('value "true"', function() {
|
|
77
|
-
var {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
102
|
+
}), testIfDocumentIsFocused('value "true"', function () {
|
|
103
|
+
var {
|
|
104
|
+
container
|
|
105
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
106
|
+
clearTextOnFocus: !0,
|
|
107
|
+
defaultValue
|
|
108
|
+
})),
|
|
109
|
+
input = findInput(container);
|
|
81
110
|
input.focus(), expect(input.node.value).toEqual("");
|
|
82
111
|
});
|
|
83
|
-
}), test('prop "defaultValue"', function() {
|
|
84
|
-
var defaultValue = "defaultValue",
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
}), test('prop "defaultValue"', function () {
|
|
113
|
+
var defaultValue = "defaultValue",
|
|
114
|
+
{
|
|
115
|
+
container
|
|
116
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
117
|
+
defaultValue
|
|
118
|
+
})),
|
|
119
|
+
input = findInput(container);
|
|
87
120
|
expect(input.value).toEqual(defaultValue);
|
|
88
|
-
}), describe('prop "disabled"', function() {
|
|
89
|
-
test('value "false"', function() {
|
|
90
|
-
var {
|
|
121
|
+
}), describe('prop "disabled"', function () {
|
|
122
|
+
test('value "false"', function () {
|
|
123
|
+
var {
|
|
124
|
+
container
|
|
125
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
126
|
+
input = findInput(container);
|
|
91
127
|
expect(input.disabled).toEqual(!1);
|
|
92
|
-
}), test('value "true"', function() {
|
|
93
|
-
var {
|
|
94
|
-
|
|
95
|
-
|
|
128
|
+
}), test('value "true"', function () {
|
|
129
|
+
var {
|
|
130
|
+
container
|
|
131
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
132
|
+
disabled: !0
|
|
133
|
+
})),
|
|
134
|
+
input = findInput(container);
|
|
96
135
|
expect(input.disabled).toEqual(!0);
|
|
97
136
|
});
|
|
98
|
-
}), describe('prop "editable"', function() {
|
|
99
|
-
test('value "true"', function() {
|
|
100
|
-
var {
|
|
137
|
+
}), describe('prop "editable"', function () {
|
|
138
|
+
test('value "true"', function () {
|
|
139
|
+
var {
|
|
140
|
+
container
|
|
141
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
142
|
+
input = findInput(container);
|
|
101
143
|
expect(input.readOnly).toEqual(!1);
|
|
102
|
-
}), test('value "false"', function() {
|
|
103
|
-
var {
|
|
104
|
-
|
|
105
|
-
|
|
144
|
+
}), test('value "false"', function () {
|
|
145
|
+
var {
|
|
146
|
+
container
|
|
147
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
148
|
+
editable: !1
|
|
149
|
+
})),
|
|
150
|
+
input = findInput(container);
|
|
106
151
|
expect(input.readOnly).toEqual(!0);
|
|
107
152
|
});
|
|
108
|
-
}), describe('prop "keyboardType"', function() {
|
|
109
|
-
test("default value", function() {
|
|
110
|
-
var {
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
}), describe('prop "keyboardType"', function () {
|
|
154
|
+
test("default value", function () {
|
|
155
|
+
var {
|
|
156
|
+
container
|
|
157
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
158
|
+
keyboardType: "default"
|
|
159
|
+
})),
|
|
160
|
+
input = findInput(container);
|
|
113
161
|
expect(input.type).toEqual("text");
|
|
114
|
-
}), test('value "email-address"', function() {
|
|
115
|
-
var {
|
|
116
|
-
|
|
117
|
-
|
|
162
|
+
}), test('value "email-address"', function () {
|
|
163
|
+
var {
|
|
164
|
+
container
|
|
165
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
166
|
+
keyboardType: "email-address"
|
|
167
|
+
})),
|
|
168
|
+
input = findInput(container);
|
|
118
169
|
expect(input.type).toEqual("email");
|
|
119
|
-
}), test('value "decimal-pad"', function() {
|
|
120
|
-
var {
|
|
121
|
-
|
|
122
|
-
|
|
170
|
+
}), test('value "decimal-pad"', function () {
|
|
171
|
+
var {
|
|
172
|
+
container
|
|
173
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
174
|
+
keyboardType: "decimal-pad"
|
|
175
|
+
})),
|
|
176
|
+
input = findInput(container);
|
|
123
177
|
expect(input.inputMode).toEqual("decimal");
|
|
124
|
-
}), test('value "number-pad"', function() {
|
|
125
|
-
var {
|
|
126
|
-
|
|
127
|
-
|
|
178
|
+
}), test('value "number-pad"', function () {
|
|
179
|
+
var {
|
|
180
|
+
container
|
|
181
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
182
|
+
keyboardType: "number-pad"
|
|
183
|
+
})),
|
|
184
|
+
input = findInput(container);
|
|
128
185
|
expect(input.inputMode).toEqual("numeric");
|
|
129
|
-
}), test('value "numeric"', function() {
|
|
130
|
-
var {
|
|
131
|
-
|
|
132
|
-
|
|
186
|
+
}), test('value "numeric"', function () {
|
|
187
|
+
var {
|
|
188
|
+
container
|
|
189
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
190
|
+
keyboardType: "numeric"
|
|
191
|
+
})),
|
|
192
|
+
input = findInput(container);
|
|
133
193
|
expect(input.inputMode).toEqual("numeric");
|
|
134
|
-
}), test('value "phone-pad"', function() {
|
|
135
|
-
var {
|
|
136
|
-
|
|
137
|
-
|
|
194
|
+
}), test('value "phone-pad"', function () {
|
|
195
|
+
var {
|
|
196
|
+
container
|
|
197
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
198
|
+
keyboardType: "phone-pad"
|
|
199
|
+
})),
|
|
200
|
+
input = findInput(container);
|
|
138
201
|
expect(input.type).toEqual("tel");
|
|
139
|
-
}), test('value "url"', function() {
|
|
140
|
-
var {
|
|
141
|
-
|
|
142
|
-
|
|
202
|
+
}), test('value "url"', function () {
|
|
203
|
+
var {
|
|
204
|
+
container
|
|
205
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
206
|
+
keyboardType: "url"
|
|
207
|
+
})),
|
|
208
|
+
input = findInput(container);
|
|
143
209
|
expect(input.type).toEqual("url");
|
|
144
210
|
});
|
|
145
|
-
}), test('prop "maxLength"', function() {
|
|
146
|
-
var {
|
|
147
|
-
|
|
211
|
+
}), test('prop "maxLength"', function () {
|
|
212
|
+
var {
|
|
213
|
+
container
|
|
214
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
215
|
+
input = findInput(container);
|
|
216
|
+
expect(input.getAttribute("maxLength")).toEqual(null), {
|
|
217
|
+
container
|
|
218
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
148
219
|
maxLength: 10
|
|
149
220
|
})), input = findInput(container), expect(input.getAttribute("maxLength")).toEqual("10");
|
|
150
|
-
}), describe('prop "multiline"', function() {
|
|
151
|
-
test('value "false"', function() {
|
|
152
|
-
var {
|
|
221
|
+
}), describe('prop "multiline"', function () {
|
|
222
|
+
test('value "false"', function () {
|
|
223
|
+
var {
|
|
224
|
+
container
|
|
225
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
226
|
+
input = findInput(container);
|
|
153
227
|
expect(input).toBeDefined();
|
|
154
|
-
}), test('value "true"', function() {
|
|
155
|
-
var {
|
|
156
|
-
|
|
157
|
-
|
|
228
|
+
}), test('value "true"', function () {
|
|
229
|
+
var {
|
|
230
|
+
container
|
|
231
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
232
|
+
multiline: !0
|
|
233
|
+
})),
|
|
234
|
+
textarea = findTextArea(container);
|
|
158
235
|
expect(textarea).toBeDefined();
|
|
159
236
|
});
|
|
160
|
-
}), describe('prop "numberOfLines"', function() {
|
|
161
|
-
test('without "multiline"', function() {
|
|
162
|
-
var {
|
|
163
|
-
|
|
164
|
-
|
|
237
|
+
}), describe('prop "numberOfLines"', function () {
|
|
238
|
+
test('without "multiline"', function () {
|
|
239
|
+
var {
|
|
240
|
+
container
|
|
241
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
242
|
+
numberOfLines: 2
|
|
243
|
+
})),
|
|
244
|
+
input = findInput(container),
|
|
245
|
+
textarea = findTextArea(container);
|
|
165
246
|
expect(input).toBeDefined(), expect(textarea).toBeNull();
|
|
166
|
-
}), test('with "multiline"', function() {
|
|
167
|
-
var {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
247
|
+
}), test('with "multiline"', function () {
|
|
248
|
+
var {
|
|
249
|
+
container
|
|
250
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
251
|
+
multiline: !0,
|
|
252
|
+
numberOfLines: 3
|
|
253
|
+
})),
|
|
254
|
+
textarea = findTextArea(container);
|
|
171
255
|
expect(textarea.getAttribute("rows")).toEqual("3");
|
|
172
256
|
});
|
|
173
|
-
}), test('prop "onBlur"', function() {
|
|
174
|
-
var onBlur = jest.fn(),
|
|
175
|
-
|
|
176
|
-
|
|
257
|
+
}), test('prop "onBlur"', function () {
|
|
258
|
+
var onBlur = jest.fn(),
|
|
259
|
+
ref = /* @__PURE__ */React.createRef();
|
|
260
|
+
act(function () {
|
|
261
|
+
render(/* @__PURE__ */_jsx(TextInput, {
|
|
177
262
|
onBlur,
|
|
178
263
|
ref
|
|
179
264
|
}));
|
|
180
265
|
});
|
|
181
|
-
var target = createEventTarget(ref.current),
|
|
182
|
-
|
|
266
|
+
var target = createEventTarget(ref.current),
|
|
267
|
+
body = createEventTarget(document.body);
|
|
268
|
+
act(function () {
|
|
183
269
|
target.focus(), body.focus({
|
|
184
270
|
relatedTarget: target.node
|
|
185
271
|
});
|
|
186
272
|
}), expect(onBlur).toHaveBeenCalledTimes(1), expect(TextInput.State.currentlyFocusedField()).toBe(null);
|
|
187
|
-
}), test.skip('prop "onChange"', function() {
|
|
188
|
-
var onChange = jest.fn(),
|
|
189
|
-
|
|
190
|
-
|
|
273
|
+
}), test.skip('prop "onChange"', function () {
|
|
274
|
+
var onChange = jest.fn(),
|
|
275
|
+
{
|
|
276
|
+
container
|
|
277
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
278
|
+
onChange
|
|
279
|
+
})),
|
|
280
|
+
input = findInput(container);
|
|
191
281
|
input.dispatchEvent(new window.Event("change", {
|
|
192
282
|
bubbles: !0
|
|
193
283
|
})), expect(onChange).toHaveBeenCalledTimes(1);
|
|
194
|
-
}), test.skip('prop "onChangeText"', function() {
|
|
195
|
-
var onChangeText = jest.fn(),
|
|
196
|
-
|
|
197
|
-
|
|
284
|
+
}), test.skip('prop "onChangeText"', function () {
|
|
285
|
+
var onChangeText = jest.fn(),
|
|
286
|
+
{
|
|
287
|
+
container
|
|
288
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
289
|
+
onChangeText
|
|
290
|
+
})),
|
|
291
|
+
input = findInput(container);
|
|
198
292
|
input.dispatchEvent(keydown({
|
|
199
293
|
key: "a"
|
|
200
294
|
})), input.dispatchEvent(new window.Event("change", {
|
|
201
295
|
bubbles: !0
|
|
202
296
|
})), expect(onChangeText).toHaveBeenCalledTimes(1), expect(onChangeText).toBeCalledWith("a");
|
|
203
|
-
}), test('prop "onFocus"', function() {
|
|
204
|
-
var onFocus = jest.fn(),
|
|
205
|
-
|
|
206
|
-
|
|
297
|
+
}), test('prop "onFocus"', function () {
|
|
298
|
+
var onFocus = jest.fn(),
|
|
299
|
+
ref = /* @__PURE__ */React.createRef();
|
|
300
|
+
act(function () {
|
|
301
|
+
render(/* @__PURE__ */_jsx(TextInput, {
|
|
207
302
|
onFocus,
|
|
208
303
|
ref
|
|
209
304
|
}));
|
|
210
305
|
});
|
|
211
306
|
var target = createEventTarget(ref.current);
|
|
212
|
-
act(function() {
|
|
307
|
+
act(function () {
|
|
213
308
|
target.focus();
|
|
214
309
|
}), expect(onFocus).toHaveBeenCalledTimes(1), target.node.focus(), expect(TextInput.State.currentlyFocusedField()).toBe(target.node);
|
|
215
|
-
}), describe('prop "onKeyPress"', function() {
|
|
216
|
-
test("arrow key", function() {
|
|
217
|
-
var onKeyPress = jest.fn(function(e) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
310
|
+
}), describe('prop "onKeyPress"', function () {
|
|
311
|
+
test("arrow key", function () {
|
|
312
|
+
var onKeyPress = jest.fn(function (e) {
|
|
313
|
+
e.persist();
|
|
314
|
+
}),
|
|
315
|
+
{
|
|
316
|
+
container
|
|
317
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
318
|
+
onKeyPress
|
|
319
|
+
})),
|
|
320
|
+
input = findInput(container);
|
|
222
321
|
input.dispatchEvent(keydown({
|
|
223
322
|
key: "ArrowLeft"
|
|
224
323
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -231,12 +330,16 @@ describe("components/TextInput", function() {
|
|
|
231
330
|
target: expect.anything()
|
|
232
331
|
})
|
|
233
332
|
}));
|
|
234
|
-
}), test("backspace key", function() {
|
|
235
|
-
var onKeyPress = jest.fn(function(e) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
333
|
+
}), test("backspace key", function () {
|
|
334
|
+
var onKeyPress = jest.fn(function (e) {
|
|
335
|
+
e.persist();
|
|
336
|
+
}),
|
|
337
|
+
{
|
|
338
|
+
container
|
|
339
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
340
|
+
onKeyPress
|
|
341
|
+
})),
|
|
342
|
+
input = findInput(container);
|
|
240
343
|
input.dispatchEvent(keydown({
|
|
241
344
|
key: "Backspace"
|
|
242
345
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -249,12 +352,16 @@ describe("components/TextInput", function() {
|
|
|
249
352
|
target: expect.anything()
|
|
250
353
|
})
|
|
251
354
|
}));
|
|
252
|
-
}), test("enter key", function() {
|
|
253
|
-
var onKeyPress = jest.fn(function(e) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
355
|
+
}), test("enter key", function () {
|
|
356
|
+
var onKeyPress = jest.fn(function (e) {
|
|
357
|
+
e.persist();
|
|
358
|
+
}),
|
|
359
|
+
{
|
|
360
|
+
container
|
|
361
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
362
|
+
onKeyPress
|
|
363
|
+
})),
|
|
364
|
+
input = findInput(container);
|
|
258
365
|
input.dispatchEvent(keydown({
|
|
259
366
|
key: "Enter"
|
|
260
367
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -267,12 +374,16 @@ describe("components/TextInput", function() {
|
|
|
267
374
|
target: expect.anything()
|
|
268
375
|
})
|
|
269
376
|
}));
|
|
270
|
-
}), test("escape key", function() {
|
|
271
|
-
var onKeyPress = jest.fn(function(e) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
377
|
+
}), test("escape key", function () {
|
|
378
|
+
var onKeyPress = jest.fn(function (e) {
|
|
379
|
+
e.persist();
|
|
380
|
+
}),
|
|
381
|
+
{
|
|
382
|
+
container
|
|
383
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
384
|
+
onKeyPress
|
|
385
|
+
})),
|
|
386
|
+
input = findInput(container);
|
|
276
387
|
input.dispatchEvent(keydown({
|
|
277
388
|
key: "Escape"
|
|
278
389
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -285,12 +396,16 @@ describe("components/TextInput", function() {
|
|
|
285
396
|
target: expect.anything()
|
|
286
397
|
})
|
|
287
398
|
}));
|
|
288
|
-
}), test("space key", function() {
|
|
289
|
-
var onKeyPress = jest.fn(function(e) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
399
|
+
}), test("space key", function () {
|
|
400
|
+
var onKeyPress = jest.fn(function (e) {
|
|
401
|
+
e.persist();
|
|
402
|
+
}),
|
|
403
|
+
{
|
|
404
|
+
container
|
|
405
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
406
|
+
onKeyPress
|
|
407
|
+
})),
|
|
408
|
+
input = findInput(container);
|
|
294
409
|
input.dispatchEvent(keydown({
|
|
295
410
|
key: " "
|
|
296
411
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -303,12 +418,16 @@ describe("components/TextInput", function() {
|
|
|
303
418
|
target: expect.anything()
|
|
304
419
|
})
|
|
305
420
|
}));
|
|
306
|
-
}), test("tab key", function() {
|
|
307
|
-
var onKeyPress = jest.fn(function(e) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
421
|
+
}), test("tab key", function () {
|
|
422
|
+
var onKeyPress = jest.fn(function (e) {
|
|
423
|
+
e.persist();
|
|
424
|
+
}),
|
|
425
|
+
{
|
|
426
|
+
container
|
|
427
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
428
|
+
onKeyPress
|
|
429
|
+
})),
|
|
430
|
+
input = findInput(container);
|
|
312
431
|
input.dispatchEvent(keydown({
|
|
313
432
|
key: "Tab"
|
|
314
433
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -321,12 +440,16 @@ describe("components/TextInput", function() {
|
|
|
321
440
|
target: expect.anything()
|
|
322
441
|
})
|
|
323
442
|
}));
|
|
324
|
-
}), test("text key", function() {
|
|
325
|
-
var onKeyPress = jest.fn(function(e) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
443
|
+
}), test("text key", function () {
|
|
444
|
+
var onKeyPress = jest.fn(function (e) {
|
|
445
|
+
e.persist();
|
|
446
|
+
}),
|
|
447
|
+
{
|
|
448
|
+
container
|
|
449
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
450
|
+
onKeyPress
|
|
451
|
+
})),
|
|
452
|
+
input = findInput(container);
|
|
330
453
|
input.dispatchEvent(keydown({
|
|
331
454
|
key: "a"
|
|
332
455
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(expect.objectContaining({
|
|
@@ -339,12 +462,16 @@ describe("components/TextInput", function() {
|
|
|
339
462
|
target: expect.anything()
|
|
340
463
|
})
|
|
341
464
|
}));
|
|
342
|
-
}), test("modifier keys are included", function() {
|
|
343
|
-
var onKeyPress = jest.fn(function(e) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
465
|
+
}), test("modifier keys are included", function () {
|
|
466
|
+
var onKeyPress = jest.fn(function (e) {
|
|
467
|
+
e.persist();
|
|
468
|
+
}),
|
|
469
|
+
{
|
|
470
|
+
container
|
|
471
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
472
|
+
onKeyPress
|
|
473
|
+
})),
|
|
474
|
+
input = findInput(container);
|
|
348
475
|
input.dispatchEvent(keydown({
|
|
349
476
|
altKey: !0,
|
|
350
477
|
ctrlKey: !0,
|
|
@@ -361,52 +488,70 @@ describe("components/TextInput", function() {
|
|
|
361
488
|
target: expect.anything()
|
|
362
489
|
})
|
|
363
490
|
}));
|
|
364
|
-
}), test('meta key + Enter calls "onKeyPress"', function() {
|
|
365
|
-
var onKeyPress = jest.fn(function(e) {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
491
|
+
}), test('meta key + Enter calls "onKeyPress"', function () {
|
|
492
|
+
var onKeyPress = jest.fn(function (e) {
|
|
493
|
+
e.persist();
|
|
494
|
+
}),
|
|
495
|
+
{
|
|
496
|
+
container
|
|
497
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
498
|
+
onKeyPress
|
|
499
|
+
})),
|
|
500
|
+
input = findInput(container);
|
|
370
501
|
input.dispatchEvent(keydown({
|
|
371
502
|
metaKey: !0,
|
|
372
503
|
key: "Enter"
|
|
373
504
|
})), expect(onKeyPress).toHaveBeenCalledTimes(1);
|
|
374
505
|
});
|
|
375
|
-
}), describe('prop "onSelectionChange"', function() {
|
|
376
|
-
test("is called on select", function() {
|
|
377
|
-
var {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
506
|
+
}), describe('prop "onSelectionChange"', function () {
|
|
507
|
+
test("is called on select", function () {
|
|
508
|
+
var {
|
|
509
|
+
container
|
|
510
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
511
|
+
defaultValue: "12345",
|
|
512
|
+
onSelectionChange
|
|
513
|
+
})),
|
|
514
|
+
input = findInput(container);
|
|
381
515
|
input.selectionStart = 0, input.selectionEnd = 3, input.dispatchEvent(new window.Event("select", {}));
|
|
382
516
|
function onSelectionChange(e) {
|
|
383
517
|
expect(e.nativeEvent.selection.end).toEqual(3), expect(e.nativeEvent.selection.start).toEqual(0);
|
|
384
518
|
}
|
|
385
|
-
}), test.skip("is called on change", function() {
|
|
386
|
-
var onSelectionChange = jest.fn(),
|
|
387
|
-
|
|
388
|
-
|
|
519
|
+
}), test.skip("is called on change", function () {
|
|
520
|
+
var onSelectionChange = jest.fn(),
|
|
521
|
+
{
|
|
522
|
+
container
|
|
523
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
524
|
+
onSelectionChange
|
|
525
|
+
})),
|
|
526
|
+
input = findInput(container);
|
|
389
527
|
input.dispatchEvent(new window.Event("input", {
|
|
390
528
|
bubbles: !0
|
|
391
529
|
})), expect(onSelectionChange).toHaveBeenCalledTimes(1);
|
|
392
530
|
});
|
|
393
|
-
}), describe('prop "onSubmitEditing"', function() {
|
|
394
|
-
test("single-line input", function(done) {
|
|
395
|
-
var {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
531
|
+
}), describe('prop "onSubmitEditing"', function () {
|
|
532
|
+
test("single-line input", function (done) {
|
|
533
|
+
var {
|
|
534
|
+
container
|
|
535
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
536
|
+
defaultValue: "12345",
|
|
537
|
+
onSubmitEditing
|
|
538
|
+
})),
|
|
539
|
+
input = findInput(container);
|
|
399
540
|
input.dispatchEvent(keydown({
|
|
400
541
|
key: "Enter"
|
|
401
542
|
}));
|
|
402
543
|
function onSubmitEditing(e) {
|
|
403
544
|
expect(e.nativeEvent.target).toBeDefined(), expect(e.nativeEvent.text).toBe("12345"), done();
|
|
404
545
|
}
|
|
405
|
-
}), test("single-line input while composing", function() {
|
|
406
|
-
var onSubmitEditing = jest.fn(),
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
546
|
+
}), test("single-line input while composing", function () {
|
|
547
|
+
var onSubmitEditing = jest.fn(),
|
|
548
|
+
{
|
|
549
|
+
container
|
|
550
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
551
|
+
defaultValue: "12345",
|
|
552
|
+
onSubmitEditing
|
|
553
|
+
})),
|
|
554
|
+
input = findInput(container);
|
|
410
555
|
input.dispatchEvent(keydown({
|
|
411
556
|
key: "Enter",
|
|
412
557
|
isComposing: !0,
|
|
@@ -416,22 +561,31 @@ describe("components/TextInput", function() {
|
|
|
416
561
|
isComposing: !1,
|
|
417
562
|
keyCode: 229
|
|
418
563
|
})), expect(onSubmitEditing).not.toHaveBeenCalled();
|
|
419
|
-
}), test("multi-line input", function() {
|
|
420
|
-
var onSubmitEditing = jest.fn(),
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
564
|
+
}), test("multi-line input", function () {
|
|
565
|
+
var onSubmitEditing = jest.fn(),
|
|
566
|
+
{
|
|
567
|
+
container
|
|
568
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
569
|
+
defaultValue: "12345",
|
|
570
|
+
multiline: !0,
|
|
571
|
+
onSubmitEditing
|
|
572
|
+
})),
|
|
573
|
+
textarea = findTextArea(container);
|
|
425
574
|
textarea.dispatchEvent(keydown({
|
|
426
575
|
key: "Enter"
|
|
427
576
|
})), expect(onSubmitEditing).not.toHaveBeenCalled();
|
|
428
|
-
}), test('multi-line input with "blurOnSubmit" triggers "onSubmitEditing"', function() {
|
|
429
|
-
var onSubmitEditing = jest.fn(),
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
577
|
+
}), test('multi-line input with "blurOnSubmit" triggers "onSubmitEditing"', function () {
|
|
578
|
+
var onSubmitEditing = jest.fn(),
|
|
579
|
+
preventDefault = jest.fn(),
|
|
580
|
+
{
|
|
581
|
+
container
|
|
582
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
583
|
+
blurOnSubmit: !0,
|
|
584
|
+
defaultValue: "12345",
|
|
585
|
+
multiline: !0,
|
|
586
|
+
onSubmitEditing
|
|
587
|
+
})),
|
|
588
|
+
textarea = findTextArea(container);
|
|
435
589
|
textarea.dispatchEvent(keydown({
|
|
436
590
|
key: "Enter",
|
|
437
591
|
preventDefault,
|
|
@@ -443,75 +597,107 @@ describe("components/TextInput", function() {
|
|
|
443
597
|
preventDefault
|
|
444
598
|
})), expect(onSubmitEditing).toHaveBeenCalledTimes(1), expect(preventDefault).toHaveBeenCalledTimes(1);
|
|
445
599
|
});
|
|
446
|
-
}), test('prop "returnKeyType"', function() {
|
|
447
|
-
var returnKeyType = "previous",
|
|
448
|
-
|
|
449
|
-
|
|
600
|
+
}), test('prop "returnKeyType"', function () {
|
|
601
|
+
var returnKeyType = "previous",
|
|
602
|
+
{
|
|
603
|
+
container
|
|
604
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
605
|
+
returnKeyType
|
|
606
|
+
})),
|
|
607
|
+
input = findInput(container);
|
|
450
608
|
expect(input.getAttribute("enterkeyhint")).toEqual(returnKeyType);
|
|
451
|
-
}), test('prop "secureTextEntry"', function() {
|
|
452
|
-
var {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
609
|
+
}), test('prop "secureTextEntry"', function () {
|
|
610
|
+
var {
|
|
611
|
+
container
|
|
612
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
613
|
+
secureTextEntry: !0
|
|
614
|
+
})),
|
|
615
|
+
input = findInput(container);
|
|
616
|
+
expect(input.getAttribute("type")).toEqual("password"), {
|
|
617
|
+
container
|
|
618
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
456
619
|
multiline: !0,
|
|
457
620
|
secureTextEntry: !0
|
|
458
621
|
}));
|
|
459
622
|
var textarea = findTextArea(container);
|
|
460
623
|
expect(textarea.getAttribute("type")).toEqual(null);
|
|
461
|
-
}), describe('prop "selectTextOnFocus"', function() {
|
|
462
|
-
testIfDocumentIsFocused('value "false"', function() {
|
|
463
|
-
var {
|
|
464
|
-
|
|
465
|
-
|
|
624
|
+
}), describe('prop "selectTextOnFocus"', function () {
|
|
625
|
+
testIfDocumentIsFocused('value "false"', function () {
|
|
626
|
+
var {
|
|
627
|
+
container
|
|
628
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
629
|
+
defaultValue: "text"
|
|
630
|
+
})),
|
|
631
|
+
input = findInput(container);
|
|
466
632
|
input.focus(), expect(input.selectionEnd).toEqual(4), expect(input.selectionStart).toEqual(4);
|
|
467
633
|
});
|
|
468
|
-
}), describe('prop "selection"', function() {
|
|
469
|
-
test("set cursor location", function() {
|
|
634
|
+
}), describe('prop "selection"', function () {
|
|
635
|
+
test("set cursor location", function () {
|
|
470
636
|
var cursorLocation = {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
637
|
+
start: 3,
|
|
638
|
+
end: 3
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
container: defaultContainer
|
|
642
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
643
|
+
defaultValue: "12345"
|
|
644
|
+
})),
|
|
645
|
+
inputDefaultSelection = findInput(defaultContainer);
|
|
476
646
|
expect(inputDefaultSelection.selectionStart).toEqual(5), expect(inputDefaultSelection.selectionEnd).toEqual(5);
|
|
477
|
-
var {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
647
|
+
var {
|
|
648
|
+
container: customContainer
|
|
649
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
650
|
+
defaultValue: "12345",
|
|
651
|
+
selection: cursorLocation
|
|
652
|
+
})),
|
|
653
|
+
inputCustomSelection = findInput(customContainer);
|
|
481
654
|
expect(inputCustomSelection.selectionStart).toEqual(cursorLocation.start), expect(inputCustomSelection.selectionEnd).toEqual(cursorLocation.end);
|
|
482
655
|
});
|
|
483
|
-
}), describe('prop "spellCheck"', function() {
|
|
484
|
-
test("default value", function() {
|
|
485
|
-
var {
|
|
656
|
+
}), describe('prop "spellCheck"', function () {
|
|
657
|
+
test("default value", function () {
|
|
658
|
+
var {
|
|
659
|
+
container
|
|
660
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {})),
|
|
661
|
+
input = findInput(container);
|
|
486
662
|
expect(input.getAttribute("spellCheck")).toEqual("true");
|
|
487
|
-
}), test('inherit from "autoCorrect"', function() {
|
|
488
|
-
var {
|
|
489
|
-
|
|
490
|
-
|
|
663
|
+
}), test('inherit from "autoCorrect"', function () {
|
|
664
|
+
var {
|
|
665
|
+
container
|
|
666
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
667
|
+
autoCorrect: !1
|
|
668
|
+
})),
|
|
669
|
+
input = findInput(container);
|
|
491
670
|
expect(input.getAttribute("spellCheck")).toEqual("false");
|
|
492
|
-
}), test('value "false"', function() {
|
|
493
|
-
var {
|
|
494
|
-
|
|
495
|
-
|
|
671
|
+
}), test('value "false"', function () {
|
|
672
|
+
var {
|
|
673
|
+
container
|
|
674
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
675
|
+
spellCheck: !1
|
|
676
|
+
})),
|
|
677
|
+
input = findInput(container);
|
|
496
678
|
expect(input.getAttribute("spellCheck")).toEqual("false");
|
|
497
679
|
});
|
|
498
|
-
}), test('prop "value"', function() {
|
|
499
|
-
var value = "value",
|
|
500
|
-
|
|
501
|
-
|
|
680
|
+
}), test('prop "value"', function () {
|
|
681
|
+
var value = "value",
|
|
682
|
+
{
|
|
683
|
+
container
|
|
684
|
+
} = render(/* @__PURE__ */_jsx(TextInput, {
|
|
685
|
+
value
|
|
686
|
+
})),
|
|
687
|
+
input = findInput(container);
|
|
502
688
|
expect(input.value).toEqual(value);
|
|
503
|
-
}), describe("imperative methods", function() {
|
|
504
|
-
test("node.clear()", function() {
|
|
505
|
-
var ref = /* @__PURE__ */
|
|
506
|
-
render(/* @__PURE__ */
|
|
689
|
+
}), describe("imperative methods", function () {
|
|
690
|
+
test("node.clear()", function () {
|
|
691
|
+
var ref = /* @__PURE__ */React.createRef();
|
|
692
|
+
render(/* @__PURE__ */_jsx(TextInput, {
|
|
507
693
|
ref
|
|
508
694
|
})), expect(typeof ref.current.clear).toBe("function");
|
|
509
|
-
}), test("node.isFocused()", function() {
|
|
510
|
-
var ref = /* @__PURE__ */
|
|
511
|
-
render(/* @__PURE__ */
|
|
695
|
+
}), test("node.isFocused()", function () {
|
|
696
|
+
var ref = /* @__PURE__ */React.createRef();
|
|
697
|
+
render(/* @__PURE__ */_jsx(TextInput, {
|
|
512
698
|
ref
|
|
513
699
|
})), expect(typeof ref.current.isFocused).toBe("function");
|
|
514
700
|
});
|
|
515
701
|
});
|
|
516
702
|
});
|
|
517
|
-
//# sourceMappingURL=index-test.js.map
|
|
703
|
+
//# sourceMappingURL=index-test.native.js.map
|