@tamagui/react-native-web-lite 1.116.0 → 1.116.2
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/cjs/AccessibilityInfo/index.js +96 -0
- package/dist/cjs/ActivityIndicator/__tests__/index-test.js +116 -0
- package/dist/cjs/ActivityIndicator/index.js +108 -0
- package/dist/cjs/Alert/index.js +25 -0
- package/dist/cjs/AppRegistry/AppContainer.js +41 -0
- package/dist/cjs/AppRegistry/__tests__/index-test.js +77 -0
- package/dist/cjs/AppRegistry/__tests__/index-test.node.js +131 -0
- package/dist/cjs/AppRegistry/index.js +98 -0
- package/dist/cjs/AppRegistry/renderApplication.js +51 -0
- package/dist/cjs/AppState/__tests__/index-test.js +33 -0
- package/dist/cjs/AppState/index.js +71 -0
- package/dist/cjs/Appearance/index.js +41 -0
- package/dist/cjs/BackHandler/index.js +32 -0
- package/dist/cjs/Clipboard/index.js +47 -0
- package/dist/cjs/DeviceEmitter.js +29 -0
- package/dist/cjs/DeviceInfo/index.js +62 -0
- package/dist/cjs/Dimensions/__tests__/index-test.js +51 -0
- package/dist/cjs/Dimensions/index.js +74 -0
- package/dist/cjs/I18nManager/index.js +30 -0
- package/dist/cjs/Image/index.js +253 -0
- package/dist/cjs/Image/types.js +14 -0
- package/dist/cjs/ImageBackground/__tests__/index-test.js +48 -0
- package/dist/cjs/ImageBackground/index.js +62 -0
- package/dist/cjs/Keyboard/index.js +35 -0
- package/dist/cjs/KeyboardAvoidingView/index.js +56 -0
- package/dist/cjs/Linking/__tests__/index-test.js +38 -0
- package/dist/cjs/Linking/index.js +86 -0
- package/dist/cjs/LogBox/index.js +31 -0
- package/dist/cjs/Modal/ModalAnimation.js +137 -0
- package/dist/cjs/Modal/ModalContent.js +75 -0
- package/dist/cjs/Modal/ModalFocusTrap.js +105 -0
- package/dist/cjs/Modal/ModalPortal.js +43 -0
- package/dist/cjs/Modal/index.js +92 -0
- package/dist/cjs/NativeModules/index.js +25 -0
- package/dist/cjs/PanResponder/index.js +29 -0
- package/dist/cjs/PixelRatio/index.js +60 -0
- package/dist/cjs/Pressable/index.js +140 -0
- package/dist/cjs/RefreshControl/index.js +48 -0
- package/dist/cjs/SafeAreaView/index.js +43 -0
- package/dist/cjs/ScrollView/ScrollViewBase.js +124 -0
- package/dist/cjs/ScrollView/index.js +374 -0
- package/dist/cjs/Share/index.js +56 -0
- package/dist/cjs/StatusBar/index.js +31 -0
- package/dist/cjs/Text/index.js +152 -0
- package/dist/cjs/Text/types.js +14 -0
- package/dist/cjs/TextInput/__tests__/index-test.js +422 -0
- package/dist/cjs/TextInput/index.js +260 -0
- package/dist/cjs/TextInput/types.js +14 -0
- package/dist/cjs/TouchableOpacity.js +123 -0
- package/dist/cjs/TouchableWithoutFeedback.js +90 -0
- package/dist/cjs/UnimplementedView.js +36 -0
- package/dist/cjs/Vibration/index.js +31 -0
- package/dist/cjs/View/index.js +101 -0
- package/dist/cjs/View/types.js +14 -0
- package/dist/cjs/createElement/__tests__/index-test.js +536 -0
- package/dist/cjs/createElement/index.js +37 -0
- package/dist/cjs/createReactDOMStyle.js +21 -0
- package/dist/cjs/findNodeHandle.js +29 -0
- package/dist/cjs/index.js +110 -0
- package/dist/cjs/render/index.js +45 -0
- package/dist/cjs/styleTypes.js +14 -0
- package/dist/cjs/types.js +14 -0
- package/dist/cjs/useColorScheme/index.js +39 -0
- package/dist/cjs/useLocaleContext/index.js +21 -0
- package/dist/cjs/useWindowDimensions/index.js +41 -0
- package/dist/cjs/vendor/react-native/Animated/Animated.js +35 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedEvent.js +143 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedImplementation.js +458 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedMock.js +126 -0
- package/dist/cjs/vendor/react-native/Animated/AnimatedPlatformConfig.js +2 -0
- package/dist/cjs/vendor/react-native/Animated/Easing.js +189 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedHelper.js +335 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedModule.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/NativeAnimatedTurboModule.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/SpringConfig.js +70 -0
- package/dist/cjs/vendor/react-native/Animated/animations/Animation.js +64 -0
- package/dist/cjs/vendor/react-native/Animated/animations/DecayAnimation.js +63 -0
- package/dist/cjs/vendor/react-native/Animated/animations/SpringAnimation.js +146 -0
- package/dist/cjs/vendor/react-native/Animated/animations/TimingAnimation.js +82 -0
- package/dist/cjs/vendor/react-native/Animated/bezier.js +72 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedImage.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedScrollView.js +38 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedText.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/components/AnimatedView.js +29 -0
- package/dist/cjs/vendor/react-native/Animated/createAnimatedComponent.js +42 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedAddition.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedColor.js +197 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDiffClamp.js +60 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedDivision.js +58 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedInterpolation.js +175 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedModulo.js +58 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedMultiplication.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedNode.js +136 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedProps.js +112 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedStyle.js +100 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedSubtraction.js +57 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTracking.js +76 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedTransform.js +100 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValue.js +182 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedValueXY.js +167 -0
- package/dist/cjs/vendor/react-native/Animated/nodes/AnimatedWithChildren.js +67 -0
- package/dist/cjs/vendor/react-native/Animated/useAnimatedProps.js +89 -0
- package/dist/cjs/vendor/react-native/FeatureFlags.js +28 -0
- package/dist/cjs/vendor/react-native/NativeEventEmitter/RCTDeviceEventEmitter.js +29 -0
- package/dist/cjs/vendor/react-native/NativeEventEmitter/index.js +73 -0
- package/dist/cjs/vendor/react-native/PanResponder/index.js +272 -0
- package/dist/cjs/vendor/react-native/TouchHistoryMath/index.js +118 -0
- package/dist/cjs/vendor/react-native/TurboModule/RCTExport.js +2 -0
- package/dist/cjs/vendor/react-native/TurboModule/TurboModuleRegistry.js +28 -0
- package/dist/cjs/vendor/react-native/Types/CoreEventTypes.js +15 -0
- package/dist/cjs/vendor/react-native/Utilities/setAndForwardRef.js +29 -0
- package/dist/cjs/vendor/react-native/emitter/EventEmitter.js +30 -0
- package/dist/cjs/vendor/react-native/emitter/EventSubscription.js +2 -0
- package/dist/cjs/vendor/react-native/emitter/_EmitterSubscription.js +55 -0
- package/dist/cjs/vendor/react-native/emitter/_EventEmitter.js +135 -0
- package/dist/cjs/vendor/react-native/emitter/_EventSubscription.js +37 -0
- package/dist/cjs/vendor/react-native/emitter/_EventSubscriptionVendor.js +76 -0
- package/dist/cjs/vendor/react-native/infoLog/index.js +25 -0
- package/dist/cjs/vendor/react-native/useRefEffect.js +30 -0
- package/dist/cjs/without-animated.js +95 -0
- package/package.json +6 -6
- package/dist/cjs/PanResponder/Alternative.cjs +0 -198
- package/dist/cjs/PanResponder/Alternative.cjs.map +0 -6
- /package/dist/cjs/AccessibilityInfo/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/ActivityIndicator/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/ActivityIndicator/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Alert/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{AppContainer.cjs.map → AppContainer.js.map} +0 -0
- /package/dist/cjs/AppRegistry/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/AppRegistry/__tests__/{index-test.node.cjs.map → index-test.node.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/AppRegistry/{renderApplication.cjs.map → renderApplication.js.map} +0 -0
- /package/dist/cjs/AppState/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/AppState/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Appearance/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/BackHandler/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Clipboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{DeviceEmitter.cjs.map → DeviceEmitter.js.map} +0 -0
- /package/dist/cjs/DeviceInfo/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Dimensions/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/Dimensions/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/I18nManager/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Image/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Image/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/ImageBackground/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/ImageBackground/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Keyboard/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/KeyboardAvoidingView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Linking/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/Linking/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/LogBox/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalAnimation.cjs.map → ModalAnimation.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalContent.cjs.map → ModalContent.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalFocusTrap.cjs.map → ModalFocusTrap.js.map} +0 -0
- /package/dist/cjs/Modal/{ModalPortal.cjs.map → ModalPortal.js.map} +0 -0
- /package/dist/cjs/Modal/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/NativeModules/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/PanResponder/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/PixelRatio/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Pressable/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/RefreshControl/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/SafeAreaView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/ScrollView/{ScrollViewBase.cjs.map → ScrollViewBase.js.map} +0 -0
- /package/dist/cjs/ScrollView/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Share/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/StatusBar/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Text/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/Text/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/TextInput/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/TextInput/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/TextInput/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/{TouchableOpacity.cjs.map → TouchableOpacity.js.map} +0 -0
- /package/dist/cjs/{TouchableWithoutFeedback.cjs.map → TouchableWithoutFeedback.js.map} +0 -0
- /package/dist/cjs/{UnimplementedView.cjs.map → UnimplementedView.js.map} +0 -0
- /package/dist/cjs/Vibration/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/View/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/View/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/createElement/__tests__/{index-test.cjs.map → index-test.js.map} +0 -0
- /package/dist/cjs/createElement/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{createReactDOMStyle.cjs.map → createReactDOMStyle.js.map} +0 -0
- /package/dist/cjs/{findNodeHandle.cjs.map → findNodeHandle.js.map} +0 -0
- /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/render/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/{styleTypes.cjs.map → styleTypes.js.map} +0 -0
- /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
- /package/dist/cjs/useColorScheme/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/useLocaleContext/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/useWindowDimensions/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{Animated.cjs.map → Animated.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedEvent.cjs.map → AnimatedEvent.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedImplementation.cjs.map → AnimatedImplementation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedMock.cjs.map → AnimatedMock.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{AnimatedPlatformConfig.cjs.map → AnimatedPlatformConfig.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{Easing.cjs.map → Easing.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedHelper.cjs.map → NativeAnimatedHelper.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedModule.cjs.map → NativeAnimatedModule.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{NativeAnimatedTurboModule.cjs.map → NativeAnimatedTurboModule.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{SpringConfig.cjs.map → SpringConfig.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{Animation.cjs.map → Animation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{DecayAnimation.cjs.map → DecayAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{SpringAnimation.cjs.map → SpringAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/animations/{TimingAnimation.cjs.map → TimingAnimation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{bezier.cjs.map → bezier.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedImage.cjs.map → AnimatedImage.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedScrollView.cjs.map → AnimatedScrollView.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedText.cjs.map → AnimatedText.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/components/{AnimatedView.cjs.map → AnimatedView.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{createAnimatedComponent.cjs.map → createAnimatedComponent.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedAddition.cjs.map → AnimatedAddition.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedColor.cjs.map → AnimatedColor.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedDiffClamp.cjs.map → AnimatedDiffClamp.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedDivision.cjs.map → AnimatedDivision.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedInterpolation.cjs.map → AnimatedInterpolation.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedModulo.cjs.map → AnimatedModulo.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedMultiplication.cjs.map → AnimatedMultiplication.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedNode.cjs.map → AnimatedNode.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedProps.cjs.map → AnimatedProps.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedStyle.cjs.map → AnimatedStyle.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedSubtraction.cjs.map → AnimatedSubtraction.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedTracking.cjs.map → AnimatedTracking.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedTransform.cjs.map → AnimatedTransform.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedValue.cjs.map → AnimatedValue.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedValueXY.cjs.map → AnimatedValueXY.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/nodes/{AnimatedWithChildren.cjs.map → AnimatedWithChildren.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Animated/{useAnimatedProps.cjs.map → useAnimatedProps.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/{FeatureFlags.cjs.map → FeatureFlags.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/NativeEventEmitter/{RCTDeviceEventEmitter.cjs.map → RCTDeviceEventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/NativeEventEmitter/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/PanResponder/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TouchHistoryMath/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TurboModule/{RCTExport.cjs.map → RCTExport.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/TurboModule/{TurboModuleRegistry.cjs.map → TurboModuleRegistry.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Types/{CoreEventTypes.cjs.map → CoreEventTypes.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/Utilities/{setAndForwardRef.cjs.map → setAndForwardRef.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{EventEmitter.cjs.map → EventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{EventSubscription.cjs.map → EventSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EmitterSubscription.cjs.map → _EmitterSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventEmitter.cjs.map → _EventEmitter.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventSubscription.cjs.map → _EventSubscription.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/emitter/{_EventSubscriptionVendor.cjs.map → _EventSubscriptionVendor.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/infoLog/{index.cjs.map → index.js.map} +0 -0
- /package/dist/cjs/vendor/react-native/{useRefEffect.cjs.map → useRefEffect.js.map} +0 -0
- /package/dist/cjs/{without-animated.cjs.map → without-animated.js.map} +0 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
return to;
|
|
11
|
+
};
|
|
12
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
13
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
14
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
15
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
16
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var import_react = require("@testing-library/react"), import_dom_event_testing_library = require("dom-event-testing-library"), import_react2 = __toESM(require("react")), import_test_utils = require("react-dom/test-utils"), import__ = __toESM(require("..")), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
|
+
function findInput(container) {
|
|
22
|
+
return container.querySelector("input");
|
|
23
|
+
}
|
|
24
|
+
function findTextArea(container) {
|
|
25
|
+
return container.querySelector("textarea");
|
|
26
|
+
}
|
|
27
|
+
const testIfDocumentIsFocused = (message, fn) => {
|
|
28
|
+
document.hasFocus && document.hasFocus() ? test(message, fn) : test.skip(`${message} \u2013 document is not focused`, () => {
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
function createEvent(type, data = {}) {
|
|
32
|
+
const event = document.createEvent("CustomEvent");
|
|
33
|
+
return event.initCustomEvent(type, !0, !0), data != null && Object.keys(data).forEach((key) => {
|
|
34
|
+
const value = data[key];
|
|
35
|
+
key === "timeStamp" && !value || Object.defineProperty(event, key, { value });
|
|
36
|
+
}), event;
|
|
37
|
+
}
|
|
38
|
+
function createKeyboardEvent(type, {
|
|
39
|
+
altKey = !1,
|
|
40
|
+
ctrlKey = !1,
|
|
41
|
+
isComposing = !1,
|
|
42
|
+
key = "",
|
|
43
|
+
keyCode = 0,
|
|
44
|
+
metaKey = !1,
|
|
45
|
+
preventDefault = () => {
|
|
46
|
+
},
|
|
47
|
+
shiftKey = !1
|
|
48
|
+
} = {}) {
|
|
49
|
+
return createEvent(type, {
|
|
50
|
+
altKey,
|
|
51
|
+
ctrlKey,
|
|
52
|
+
isComposing,
|
|
53
|
+
key,
|
|
54
|
+
keyCode,
|
|
55
|
+
metaKey,
|
|
56
|
+
preventDefault,
|
|
57
|
+
shiftKey
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function keydown(payload) {
|
|
61
|
+
return createKeyboardEvent("keydown", payload);
|
|
62
|
+
}
|
|
63
|
+
describe("components/TextInput", () => {
|
|
64
|
+
describe('prop "autoComplete"', () => {
|
|
65
|
+
test('value "on"', () => {
|
|
66
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
67
|
+
expect(input.getAttribute("autoComplete")).toEqual("on");
|
|
68
|
+
}), test('value "off"', () => {
|
|
69
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { autoComplete: "off" })), input = findInput(container);
|
|
70
|
+
expect(input.getAttribute("autoComplete")).toEqual("off");
|
|
71
|
+
}), test("autoCompleteType fallback", () => {
|
|
72
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { autoCompleteType: "off" })), input = findInput(container);
|
|
73
|
+
expect(input.getAttribute("autoComplete")).toEqual("off");
|
|
74
|
+
});
|
|
75
|
+
}), describe('prop "autoFocus"', () => {
|
|
76
|
+
test('value "false"', () => {
|
|
77
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
78
|
+
expect(document.activeElement).not.toBe(input);
|
|
79
|
+
}), test('value "true"', () => {
|
|
80
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { autoFocus: !0 })), input = findInput(container);
|
|
81
|
+
expect(document.activeElement).toBe(input);
|
|
82
|
+
});
|
|
83
|
+
}), describe('prop "clearTextOnFocus"', () => {
|
|
84
|
+
const defaultValue = "defaultValue";
|
|
85
|
+
testIfDocumentIsFocused('value "false"', () => {
|
|
86
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue })), input = findInput(container);
|
|
87
|
+
input.focus(), expect(input.node.value).toEqual(defaultValue);
|
|
88
|
+
}), testIfDocumentIsFocused('value "true"', () => {
|
|
89
|
+
const { container } = (0, import_react.render)(
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { clearTextOnFocus: !0, defaultValue })
|
|
91
|
+
), input = findInput(container);
|
|
92
|
+
input.focus(), expect(input.node.value).toEqual("");
|
|
93
|
+
});
|
|
94
|
+
}), test('prop "defaultValue"', () => {
|
|
95
|
+
const defaultValue = "defaultValue", { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue })), input = findInput(container);
|
|
96
|
+
expect(input.value).toEqual(defaultValue);
|
|
97
|
+
}), describe('prop "disabled"', () => {
|
|
98
|
+
test('value "false"', () => {
|
|
99
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
100
|
+
expect(input.disabled).toEqual(!1);
|
|
101
|
+
}), test('value "true"', () => {
|
|
102
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { disabled: !0 })), input = findInput(container);
|
|
103
|
+
expect(input.disabled).toEqual(!0);
|
|
104
|
+
});
|
|
105
|
+
}), describe('prop "editable"', () => {
|
|
106
|
+
test('value "true"', () => {
|
|
107
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
108
|
+
expect(input.readOnly).toEqual(!1);
|
|
109
|
+
}), test('value "false"', () => {
|
|
110
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { editable: !1 })), input = findInput(container);
|
|
111
|
+
expect(input.readOnly).toEqual(!0);
|
|
112
|
+
});
|
|
113
|
+
}), describe('prop "keyboardType"', () => {
|
|
114
|
+
test("default value", () => {
|
|
115
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "default" })), input = findInput(container);
|
|
116
|
+
expect(input.type).toEqual("text");
|
|
117
|
+
}), test('value "email-address"', () => {
|
|
118
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "email-address" })), input = findInput(container);
|
|
119
|
+
expect(input.type).toEqual("email");
|
|
120
|
+
}), test('value "decimal-pad"', () => {
|
|
121
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "decimal-pad" })), input = findInput(container);
|
|
122
|
+
expect(input.inputMode).toEqual("decimal");
|
|
123
|
+
}), test('value "number-pad"', () => {
|
|
124
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "number-pad" })), input = findInput(container);
|
|
125
|
+
expect(input.inputMode).toEqual("numeric");
|
|
126
|
+
}), test('value "numeric"', () => {
|
|
127
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "numeric" })), input = findInput(container);
|
|
128
|
+
expect(input.inputMode).toEqual("numeric");
|
|
129
|
+
}), test('value "phone-pad"', () => {
|
|
130
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "phone-pad" })), input = findInput(container);
|
|
131
|
+
expect(input.type).toEqual("tel");
|
|
132
|
+
}), test('value "url"', () => {
|
|
133
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { keyboardType: "url" })), input = findInput(container);
|
|
134
|
+
expect(input.type).toEqual("url");
|
|
135
|
+
});
|
|
136
|
+
}), test('prop "maxLength"', () => {
|
|
137
|
+
let { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
138
|
+
expect(input.getAttribute("maxLength")).toEqual(null), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { maxLength: 10 })), input = findInput(container), expect(input.getAttribute("maxLength")).toEqual("10");
|
|
139
|
+
}), describe('prop "multiline"', () => {
|
|
140
|
+
test('value "false"', () => {
|
|
141
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
142
|
+
expect(input).toBeDefined();
|
|
143
|
+
}), test('value "true"', () => {
|
|
144
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { multiline: !0 })), textarea = findTextArea(container);
|
|
145
|
+
expect(textarea).toBeDefined();
|
|
146
|
+
});
|
|
147
|
+
}), describe('prop "numberOfLines"', () => {
|
|
148
|
+
test('without "multiline"', () => {
|
|
149
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { numberOfLines: 2 })), input = findInput(container), textarea = findTextArea(container);
|
|
150
|
+
expect(input).toBeDefined(), expect(textarea).toBeNull();
|
|
151
|
+
}), test('with "multiline"', () => {
|
|
152
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { multiline: !0, numberOfLines: 3 })), textarea = findTextArea(container);
|
|
153
|
+
expect(textarea.getAttribute("rows")).toEqual("3");
|
|
154
|
+
});
|
|
155
|
+
}), test('prop "onBlur"', () => {
|
|
156
|
+
const onBlur = jest.fn(), ref = import_react2.default.createRef();
|
|
157
|
+
(0, import_test_utils.act)(() => {
|
|
158
|
+
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onBlur, ref }));
|
|
159
|
+
});
|
|
160
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(ref.current), body = (0, import_dom_event_testing_library.createEventTarget)(document.body);
|
|
161
|
+
(0, import_test_utils.act)(() => {
|
|
162
|
+
target.focus(), body.focus({ relatedTarget: target.node });
|
|
163
|
+
}), expect(onBlur).toHaveBeenCalledTimes(1), expect(import__.default.State.currentlyFocusedField()).toBe(null);
|
|
164
|
+
}), test.skip('prop "onChange"', () => {
|
|
165
|
+
const onChange = jest.fn(), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onChange }));
|
|
166
|
+
findInput(container).dispatchEvent(new window.Event("change", { bubbles: !0 })), expect(onChange).toHaveBeenCalledTimes(1);
|
|
167
|
+
}), test.skip('prop "onChangeText"', () => {
|
|
168
|
+
const onChangeText = jest.fn(), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onChangeText })), input = findInput(container);
|
|
169
|
+
input.dispatchEvent(keydown({ key: "a" })), input.dispatchEvent(new window.Event("change", { bubbles: !0 })), expect(onChangeText).toHaveBeenCalledTimes(1), expect(onChangeText).toBeCalledWith("a");
|
|
170
|
+
}), test('prop "onFocus"', () => {
|
|
171
|
+
const onFocus = jest.fn(), ref = import_react2.default.createRef();
|
|
172
|
+
(0, import_test_utils.act)(() => {
|
|
173
|
+
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onFocus, ref }));
|
|
174
|
+
});
|
|
175
|
+
const target = (0, import_dom_event_testing_library.createEventTarget)(ref.current);
|
|
176
|
+
(0, import_test_utils.act)(() => {
|
|
177
|
+
target.focus();
|
|
178
|
+
}), expect(onFocus).toHaveBeenCalledTimes(1), target.node.focus(), expect(import__.default.State.currentlyFocusedField()).toBe(target.node);
|
|
179
|
+
}), describe('prop "onKeyPress"', () => {
|
|
180
|
+
test("arrow key", () => {
|
|
181
|
+
const onKeyPress = jest.fn((e) => {
|
|
182
|
+
e.persist();
|
|
183
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
184
|
+
findInput(container).dispatchEvent(keydown({ key: "ArrowLeft" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
185
|
+
expect.objectContaining({
|
|
186
|
+
nativeEvent: expect.objectContaining({
|
|
187
|
+
altKey: !1,
|
|
188
|
+
ctrlKey: !1,
|
|
189
|
+
key: "ArrowLeft",
|
|
190
|
+
metaKey: !1,
|
|
191
|
+
shiftKey: !1,
|
|
192
|
+
target: expect.anything()
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
);
|
|
196
|
+
}), test("backspace key", () => {
|
|
197
|
+
const onKeyPress = jest.fn((e) => {
|
|
198
|
+
e.persist();
|
|
199
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
200
|
+
findInput(container).dispatchEvent(keydown({ key: "Backspace" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
201
|
+
expect.objectContaining({
|
|
202
|
+
nativeEvent: expect.objectContaining({
|
|
203
|
+
altKey: !1,
|
|
204
|
+
ctrlKey: !1,
|
|
205
|
+
key: "Backspace",
|
|
206
|
+
metaKey: !1,
|
|
207
|
+
shiftKey: !1,
|
|
208
|
+
target: expect.anything()
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
}), test("enter key", () => {
|
|
213
|
+
const onKeyPress = jest.fn((e) => {
|
|
214
|
+
e.persist();
|
|
215
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
216
|
+
findInput(container).dispatchEvent(keydown({ key: "Enter" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
217
|
+
expect.objectContaining({
|
|
218
|
+
nativeEvent: expect.objectContaining({
|
|
219
|
+
altKey: !1,
|
|
220
|
+
ctrlKey: !1,
|
|
221
|
+
key: "Enter",
|
|
222
|
+
metaKey: !1,
|
|
223
|
+
shiftKey: !1,
|
|
224
|
+
target: expect.anything()
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
);
|
|
228
|
+
}), test("escape key", () => {
|
|
229
|
+
const onKeyPress = jest.fn((e) => {
|
|
230
|
+
e.persist();
|
|
231
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
232
|
+
findInput(container).dispatchEvent(keydown({ key: "Escape" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
233
|
+
expect.objectContaining({
|
|
234
|
+
nativeEvent: expect.objectContaining({
|
|
235
|
+
altKey: !1,
|
|
236
|
+
ctrlKey: !1,
|
|
237
|
+
key: "Escape",
|
|
238
|
+
metaKey: !1,
|
|
239
|
+
shiftKey: !1,
|
|
240
|
+
target: expect.anything()
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
);
|
|
244
|
+
}), test("space key", () => {
|
|
245
|
+
const onKeyPress = jest.fn((e) => {
|
|
246
|
+
e.persist();
|
|
247
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
248
|
+
findInput(container).dispatchEvent(keydown({ key: " " })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
249
|
+
expect.objectContaining({
|
|
250
|
+
nativeEvent: expect.objectContaining({
|
|
251
|
+
altKey: !1,
|
|
252
|
+
ctrlKey: !1,
|
|
253
|
+
key: " ",
|
|
254
|
+
metaKey: !1,
|
|
255
|
+
shiftKey: !1,
|
|
256
|
+
target: expect.anything()
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
);
|
|
260
|
+
}), test("tab key", () => {
|
|
261
|
+
const onKeyPress = jest.fn((e) => {
|
|
262
|
+
e.persist();
|
|
263
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
264
|
+
findInput(container).dispatchEvent(keydown({ key: "Tab" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
265
|
+
expect.objectContaining({
|
|
266
|
+
nativeEvent: expect.objectContaining({
|
|
267
|
+
altKey: !1,
|
|
268
|
+
ctrlKey: !1,
|
|
269
|
+
key: "Tab",
|
|
270
|
+
metaKey: !1,
|
|
271
|
+
shiftKey: !1,
|
|
272
|
+
target: expect.anything()
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
);
|
|
276
|
+
}), test("text key", () => {
|
|
277
|
+
const onKeyPress = jest.fn((e) => {
|
|
278
|
+
e.persist();
|
|
279
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
280
|
+
findInput(container).dispatchEvent(keydown({ key: "a" })), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
281
|
+
expect.objectContaining({
|
|
282
|
+
nativeEvent: expect.objectContaining({
|
|
283
|
+
altKey: !1,
|
|
284
|
+
ctrlKey: !1,
|
|
285
|
+
key: "a",
|
|
286
|
+
metaKey: !1,
|
|
287
|
+
shiftKey: !1,
|
|
288
|
+
target: expect.anything()
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
);
|
|
292
|
+
}), test("modifier keys are included", () => {
|
|
293
|
+
const onKeyPress = jest.fn((e) => {
|
|
294
|
+
e.persist();
|
|
295
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
296
|
+
findInput(container).dispatchEvent(
|
|
297
|
+
keydown({
|
|
298
|
+
altKey: !0,
|
|
299
|
+
ctrlKey: !0,
|
|
300
|
+
metaKey: !0,
|
|
301
|
+
shiftKey: !0,
|
|
302
|
+
key: " "
|
|
303
|
+
})
|
|
304
|
+
), expect(onKeyPress).toHaveBeenCalledTimes(1), expect(onKeyPress).toBeCalledWith(
|
|
305
|
+
expect.objectContaining({
|
|
306
|
+
nativeEvent: expect.objectContaining({
|
|
307
|
+
altKey: !0,
|
|
308
|
+
ctrlKey: !0,
|
|
309
|
+
key: " ",
|
|
310
|
+
metaKey: !0,
|
|
311
|
+
shiftKey: !0,
|
|
312
|
+
target: expect.anything()
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
);
|
|
316
|
+
}), test('meta key + Enter calls "onKeyPress"', () => {
|
|
317
|
+
const onKeyPress = jest.fn((e) => {
|
|
318
|
+
e.persist();
|
|
319
|
+
}), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onKeyPress }));
|
|
320
|
+
findInput(container).dispatchEvent(
|
|
321
|
+
keydown({
|
|
322
|
+
metaKey: !0,
|
|
323
|
+
key: "Enter"
|
|
324
|
+
})
|
|
325
|
+
), expect(onKeyPress).toHaveBeenCalledTimes(1);
|
|
326
|
+
});
|
|
327
|
+
}), describe('prop "onSelectionChange"', () => {
|
|
328
|
+
test("is called on select", () => {
|
|
329
|
+
const { container } = (0, import_react.render)(
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345", onSelectionChange })
|
|
331
|
+
), input = findInput(container);
|
|
332
|
+
input.selectionStart = 0, input.selectionEnd = 3, input.dispatchEvent(new window.Event("select", {}));
|
|
333
|
+
function onSelectionChange(e) {
|
|
334
|
+
expect(e.nativeEvent.selection.end).toEqual(3), expect(e.nativeEvent.selection.start).toEqual(0);
|
|
335
|
+
}
|
|
336
|
+
}), test.skip("is called on change", () => {
|
|
337
|
+
const onSelectionChange = jest.fn(), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { onSelectionChange }));
|
|
338
|
+
findInput(container).dispatchEvent(new window.Event("input", { bubbles: !0 })), expect(onSelectionChange).toHaveBeenCalledTimes(1);
|
|
339
|
+
});
|
|
340
|
+
}), describe('prop "onSubmitEditing"', () => {
|
|
341
|
+
test("single-line input", (done) => {
|
|
342
|
+
const { container } = (0, import_react.render)(
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345", onSubmitEditing })
|
|
344
|
+
);
|
|
345
|
+
findInput(container).dispatchEvent(keydown({ key: "Enter" }));
|
|
346
|
+
function onSubmitEditing(e) {
|
|
347
|
+
expect(e.nativeEvent.target).toBeDefined(), expect(e.nativeEvent.text).toBe("12345"), done();
|
|
348
|
+
}
|
|
349
|
+
}), test("single-line input while composing", () => {
|
|
350
|
+
const onSubmitEditing = jest.fn(), { container } = (0, import_react.render)(
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345", onSubmitEditing })
|
|
352
|
+
), input = findInput(container);
|
|
353
|
+
input.dispatchEvent(keydown({ key: "Enter", isComposing: !0, keyCode: 13 })), input.dispatchEvent(keydown({ key: "Enter", isComposing: !1, keyCode: 229 })), expect(onSubmitEditing).not.toHaveBeenCalled();
|
|
354
|
+
}), test("multi-line input", () => {
|
|
355
|
+
const onSubmitEditing = jest.fn(), { container } = (0, import_react.render)(
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345", multiline: !0, onSubmitEditing })
|
|
357
|
+
);
|
|
358
|
+
findTextArea(container).dispatchEvent(keydown({ key: "Enter" })), expect(onSubmitEditing).not.toHaveBeenCalled();
|
|
359
|
+
}), test('multi-line input with "blurOnSubmit" triggers "onSubmitEditing"', () => {
|
|
360
|
+
const onSubmitEditing = jest.fn(), preventDefault = jest.fn(), { container } = (0, import_react.render)(
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
362
|
+
import__.default,
|
|
363
|
+
{
|
|
364
|
+
blurOnSubmit: !0,
|
|
365
|
+
defaultValue: "12345",
|
|
366
|
+
multiline: !0,
|
|
367
|
+
onSubmitEditing
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
), textarea = findTextArea(container);
|
|
371
|
+
textarea.dispatchEvent(keydown({ key: "Enter", preventDefault, shiftKey: !0 })), expect(onSubmitEditing).not.toHaveBeenCalledWith(
|
|
372
|
+
expect.objectContaining({ shiftKey: !0 })
|
|
373
|
+
), expect(preventDefault).not.toHaveBeenCalled(), textarea.dispatchEvent(keydown({ key: "Enter", preventDefault })), expect(onSubmitEditing).toHaveBeenCalledTimes(1), expect(preventDefault).toHaveBeenCalledTimes(1);
|
|
374
|
+
});
|
|
375
|
+
}), test('prop "returnKeyType"', () => {
|
|
376
|
+
const returnKeyType = "previous", { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { returnKeyType })), input = findInput(container);
|
|
377
|
+
expect(input.getAttribute("enterkeyhint")).toEqual(returnKeyType);
|
|
378
|
+
}), test('prop "secureTextEntry"', () => {
|
|
379
|
+
let { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { secureTextEntry: !0 }));
|
|
380
|
+
const input = findInput(container);
|
|
381
|
+
expect(input.getAttribute("type")).toEqual("password"), { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { multiline: !0, secureTextEntry: !0 }));
|
|
382
|
+
const textarea = findTextArea(container);
|
|
383
|
+
expect(textarea.getAttribute("type")).toEqual(null);
|
|
384
|
+
}), describe('prop "selectTextOnFocus"', () => {
|
|
385
|
+
testIfDocumentIsFocused('value "false"', () => {
|
|
386
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "text" })), input = findInput(container);
|
|
387
|
+
input.focus(), expect(input.selectionEnd).toEqual(4), expect(input.selectionStart).toEqual(4);
|
|
388
|
+
});
|
|
389
|
+
}), describe('prop "selection"', () => {
|
|
390
|
+
test("set cursor location", () => {
|
|
391
|
+
const cursorLocation = { start: 3, end: 3 }, { container: defaultContainer } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345" })), inputDefaultSelection = findInput(defaultContainer);
|
|
392
|
+
expect(inputDefaultSelection.selectionStart).toEqual(5), expect(inputDefaultSelection.selectionEnd).toEqual(5);
|
|
393
|
+
const { container: customContainer } = (0, import_react.render)(
|
|
394
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { defaultValue: "12345", selection: cursorLocation })
|
|
395
|
+
), inputCustomSelection = findInput(customContainer);
|
|
396
|
+
expect(inputCustomSelection.selectionStart).toEqual(cursorLocation.start), expect(inputCustomSelection.selectionEnd).toEqual(cursorLocation.end);
|
|
397
|
+
});
|
|
398
|
+
}), describe('prop "spellCheck"', () => {
|
|
399
|
+
test("default value", () => {
|
|
400
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, {})), input = findInput(container);
|
|
401
|
+
expect(input.getAttribute("spellCheck")).toEqual("true");
|
|
402
|
+
}), test('inherit from "autoCorrect"', () => {
|
|
403
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { autoCorrect: !1 })), input = findInput(container);
|
|
404
|
+
expect(input.getAttribute("spellCheck")).toEqual("false");
|
|
405
|
+
}), test('value "false"', () => {
|
|
406
|
+
const { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { spellCheck: !1 })), input = findInput(container);
|
|
407
|
+
expect(input.getAttribute("spellCheck")).toEqual("false");
|
|
408
|
+
});
|
|
409
|
+
}), test('prop "value"', () => {
|
|
410
|
+
const value = "value", { container } = (0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { value })), input = findInput(container);
|
|
411
|
+
expect(input.value).toEqual(value);
|
|
412
|
+
}), describe("imperative methods", () => {
|
|
413
|
+
test("node.clear()", () => {
|
|
414
|
+
const ref = import_react2.default.createRef();
|
|
415
|
+
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { ref })), expect(typeof ref.current.clear).toBe("function");
|
|
416
|
+
}), test("node.isFocused()", () => {
|
|
417
|
+
const ref = import_react2.default.createRef();
|
|
418
|
+
(0, import_react.render)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.default, { ref })), expect(typeof ref.current.isFocused).toBe("function");
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
//# sourceMappingURL=index-test.js.map
|