react-native-ui-lib 8.0.1 → 8.1.0
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/jestSetup/jest-setup.js +154 -0
- package/lib/components/DynamicFonts/FontDownloader.d.js +1 -0
- package/lib/components/DynamicFonts/FontLoader.d.js +1 -0
- package/lib/components/DynamicFonts/NoPermissionsAcquirer.d.js +1 -0
- package/lib/components/DynamicFonts/PermissionsAcquirer.android.d.js +1 -0
- package/lib/components/DynamicFonts/PermissionsAcquirer.ios.d.js +2 -0
- package/lib/components/DynamicFonts/PermissionsAcquirer.web.d.js +2 -0
- package/lib/components/DynamicFonts/RNFSPackage.d.js +1 -0
- package/lib/components/DynamicFonts/index.d.js +3 -0
- package/lib/components/HighlighterOverlayView/index.d.js +1 -0
- package/lib/components/HighlighterOverlayView/index.web.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.d.js +2 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.ios.d.js +2 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardViewBase.d.js +2 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/index.web.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/index.d.js +5 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/TextInputKeyboardManager.android.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/TextInputKeyboardManager/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/index.d.js +7 -0
- package/lib/components/Keyboard/KeyboardAwareInsetsView/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.android.d.js +1 -0
- package/lib/components/Keyboard/KeyboardTrackingView/KeyboardTrackingView.ios.d.js +10 -0
- package/lib/components/Keyboard/KeyboardTrackingView/index.d.js +1 -0
- package/lib/components/Keyboard/KeyboardTrackingView/index.web.d.js +1 -0
- package/lib/components/Keyboard/index.d.js +4 -0
- package/lib/components/SafeArea/SafeAreaInsetsManager.d.js +1 -0
- package/lib/components/SafeArea/SafeAreaSpacerView.d.js +1 -0
- package/lib/components/SafeArea/SafeAreaSpacerView.web.d.js +1 -0
- package/lib/components/SafeArea/index.d.js +1 -0
- package/lib/components/index.d.js +6 -0
- package/lib/scripts/releaseNative.js +72 -0
- package/lib/specs/HighlighterViewNativeComponent.d.js +1 -0
- package/lib/specs/HighlighterViewNativeComponent.d.ts +61 -0
- package/lib/specs/HighlighterViewNativeComponent.js +8 -0
- package/lib/specs/KeyboardTrackingViewNativeComponent.d.js +1 -0
- package/lib/specs/KeyboardTrackingViewNativeComponent.d.ts +58 -0
- package/lib/specs/KeyboardTrackingViewNativeComponent.js +8 -0
- package/package.json +7 -31
- package/scripts/build/build.js +35 -0
- package/scripts/build/buildPackages/buildComponentsPackages.js +18 -0
- package/scripts/build/buildPackages/buildCustomPackages.js +106 -0
- package/scripts/build/buildPackages/index.js +6 -0
- package/scripts/createCalendarMockData.js +37 -0
- package/scripts/docs/buildDocs.js +1 -0
- package/scripts/prepush.js +71 -0
- package/scripts/release/prReleaseNotes.js +6 -0
- package/scripts/release/release.js +99 -0
- package/scripts/updateWebAssets.js +88 -0
- package/scripts/utils.js +21 -0
- package/src/assets/__tests__/Assets.spec.js +110 -0
- package/src/commons/__tests__/baseComponent.spec.js +36 -0
- package/src/commons/__tests__/constants.spec.js +202 -0
- package/src/commons/__tests__/modifiers.spec.js +453 -0
- package/src/components/WheelPicker/__tests__/index.spec.js +121 -0
- package/src/components/WheelPicker/__tests__/useListMiddleIndex.spec.js +40 -0
- package/src/components/WheelPicker/__tests__/usePresenter.spec.js +87 -0
- package/src/components/avatar/__tests__/index.spec.js +25 -0
- package/src/components/badge/__tests__/index.spec.js +84 -0
- package/src/components/button/__tests__/index.driver.spec.js +209 -0
- package/src/components/button/__tests__/index.spec.js +287 -0
- package/src/components/button/index.js +30 -8
- package/src/components/card/__tests__/CardPresenter.spec.js +35 -0
- package/src/components/carousel/__tests__/CarouselPresenter.spec.js +52 -0
- package/src/components/carousel/__tests__/index.spec.js +89 -0
- package/src/components/carousel/index.js +2 -1
- package/src/components/checkbox/__tests__/index.spec.js +357 -0
- package/src/components/chip/__tests__/index.spec.js +63 -0
- package/src/components/colorSwatch/index.js +1 -1
- package/src/components/connectionStatusBar/__tests__/index.spec.js +41 -0
- package/src/components/dateTimePicker/__tests__/index.spec.js +44 -0
- package/src/components/dialog/__tests__/index.new.spec.js +118 -0
- package/src/components/featureHighlight/__tests__/index.spec.js +76 -0
- package/src/components/floatingButton/__tests__/index.spec.js +229 -0
- package/src/components/floatingButton/index.js +66 -35
- package/src/components/hint/__tests__/index.spec.js +108 -0
- package/src/components/image/__tests__/index.spec.js +56 -0
- package/src/components/image/image.api.json +193 -1
- package/src/components/maskedInput/__tests__/maskedInput.new.spec.js +19 -0
- package/src/components/maskedInput/__tests__/maskedInput.old.spec.js +20 -0
- package/src/components/modal/__tests__/index.spec.js +58 -0
- package/src/components/numberInput/__tests__/Presenter.spec.js +374 -0
- package/src/components/numberInput/__tests__/index.spec.js +38 -0
- package/src/components/numberInput/numberInput.api.json +131 -6
- package/src/components/overlay/index.js +2 -1
- package/src/components/pageControl/pageControl.api.json +175 -1
- package/src/components/panView/__tests__/panningUtil.spec.js +693 -0
- package/src/components/picker/__tests__/PickerPresenter.spec.js +15 -0
- package/src/components/picker/__tests__/index.spec.js +364 -0
- package/src/components/picker/helpers/__tests__/usePickerLabel.spec.js +96 -0
- package/src/components/radioButton/__tests__/index.spec.js +43 -0
- package/src/components/radioGroup/__tests__/index.spec.js +96 -0
- package/src/components/sectionsWheelPicker/__tests__/index.spec.js +35 -0
- package/src/components/sectionsWheelPicker/__tests__/mockSections.js +28 -0
- package/src/components/segmentedControl/__tests__/index.spec.js +25 -0
- package/src/components/slider/__tests__/index.spec.js +35 -0
- package/src/components/slider/index.js +12 -1
- package/src/components/slider/slider.api.json +11 -0
- package/src/components/sortableGridList/__tests__/index.spec.js +51 -0
- package/src/components/sortableGridList/__tests__/usePresenter.spec.js +231 -0
- package/src/components/sortableGridList/sortableGridList.api.json +44 -1
- package/src/components/sortableList/SortableList.api.json +51 -3
- package/src/components/sortableList/__tests__/index.spec.js +105 -0
- package/src/components/stackAggregator/assets/arrow-down.png +0 -0
- package/src/components/stackAggregator/assets/arrow-down@2x.png +0 -0
- package/src/components/stackAggregator/assets/arrow-down@3x.png +0 -0
- package/src/components/switch/__tests__/index.spec.js +96 -0
- package/src/components/text/__tests__/index.driver.spec.js +124 -0
- package/src/components/text/__tests__/index.spec.js +245 -0
- package/src/components/textField/__tests__/Presenter.spec.js +240 -0
- package/src/components/textField/__tests__/index.driver.spec.js +639 -0
- package/src/components/timeline/__tests__/driver.index.spec.js +133 -0
- package/src/helpers/__tests__/AvatarHelper.spec.js +170 -0
- package/src/hooks/useDidUpdate/__tests__/useDidUpdate.spec.js +80 -0
- package/src/hooks/useOrientation/__tests__/useOrientation.spec.js +70 -0
- package/src/hooks/useToggleValue/__tests__/useToggleValue.spec.js +89 -0
- package/src/incubator/calendar/__tests__/DateUtils.spec.js +367 -0
- package/src/incubator/expandableOverlay/__tests__/index.spec.js +114 -0
- package/src/incubator/gradient/__tests__/useAngleTransform.spec.js +126 -0
- package/src/incubator/slider/__tests__/SliderPresenter.spec.js +43 -0
- package/src/incubator/slider/__tests__/index.spec.js +34 -0
- package/src/incubator/slider/slider.api.json +11 -0
- package/src/incubator/toast/__tests__/index.spec.js +64 -0
- package/src/style/__tests__/colors.spec.js +313 -0
- package/src/style/__tests__/scheme.spec.js +119 -0
- package/src/style/typographyPresets.js +26 -23
- package/src/utils/__tests__/Playground.perf.js +14 -0
- package/src/utils/__tests__/imageUtils.spec.js +54 -0
- package/src/utils/__tests__/textUtils.spec.js +446 -0
- package/.eslintrc.js +0 -56
- package/babel.config.js +0 -35
- package/index.js +0 -10
- package/lib/android/build.gradle +0 -32
- package/lib/android/src/main/AndroidManifest.xml +0 -4
- package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +0 -28
- package/lib/android/src/main/java/com/wix/reactnativeuilib/dynamicfont/DynamicFontModule.java +0 -139
- package/lib/android/src/main/java/com/wix/reactnativeuilib/dynamicfont/DynamicFontPackage.java +0 -28
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlightFrame.java +0 -33
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlightViewTagParams.java +0 -50
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterView.java +0 -167
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +0 -131
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewPackage.java +0 -28
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/UiUtils.java +0 -50
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/AppContextHolder.java +0 -52
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.java +0 -213
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.java +0 -39
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewManager.java +0 -29
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewShadow.java +0 -29
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.java +0 -34
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/KeyboardInputPackage.java +0 -49
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactContextHolder.java +0 -16
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor.java +0 -83
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor.java +0 -163
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/PredicateFunc.java +0 -5
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +0 -33
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils.java +0 -65
- package/lib/android/src/main/java/com/wix/reactnativeuilib/utils/LogForwarder.java +0 -45
- package/lib/android/src/main/res/layout/wheel_picker.xml +0 -9
- package/lib/android/src/main/res/values/colors.xml +0 -9
- package/lib/android/src/main/res/values/styles.xml +0 -9
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardRegistry/keyboardRegistry.api.json +0 -50
- package/lib/components/Keyboard/KeyboardAccessoryView/keyboardAccessoryView.api.json +0 -58
- package/lib/components/Keyboard/KeyboardAwareInsetsView/keyboardAwareInsetsView.api.json +0 -14
- package/lib/components/Keyboard/KeyboardTrackingView/keyboardTrackingView.api.json +0 -86
- package/lib/ios/reactnativeuilib/dynamicfont/DynamicFont.h +0 -9
- package/lib/ios/reactnativeuilib/dynamicfont/DynamicFont.m +0 -115
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterView.h +0 -19
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterView.m +0 -216
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterViewManager.h +0 -6
- package/lib/ios/reactnativeuilib/highlighterview/HighlighterViewManager.m +0 -28
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/Color+Interpolation.h +0 -39
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/Color+Interpolation.m +0 -160
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNAnimatorTemp.h +0 -36
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNAnimatorTemp.m +0 -121
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolable.h +0 -48
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolable.m +0 -27
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/LNInterpolation.h +0 -16
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/NSValue+Interpolation.h +0 -19
- package/lib/ios/reactnativeuilib/keyboardinput/lninterpolation/NSValue+Interpolation.mm +0 -155
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.h +0 -16
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +0 -450
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +0 -18
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +0 -99
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.h +0 -14
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +0 -827
- package/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.h +0 -44
- package/lib/ios/reactnativeuilib/keyboardtrackingview/ObservingInputAccessoryViewTemp.m +0 -171
- package/lib/ios/reactnativeuilib/keyboardtrackingview/UIResponder+FirstResponderTemp.h +0 -6
- package/lib/ios/reactnativeuilib/keyboardtrackingview/UIResponder+FirstResponderTemp.m +0 -17
- package/lib/ios/reactnativeuilib/safearea/SafeAreaManager.h +0 -6
- package/lib/ios/reactnativeuilib/safearea/SafeAreaManager.m +0 -105
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerShadowView.h +0 -5
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerShadowView.m +0 -20
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerView.h +0 -7
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerView.m +0 -76
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewLocalData.h +0 -9
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewLocalData.m +0 -14
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewManager.h +0 -5
- package/lib/ios/reactnativeuilib/safearea/SafeAreaSpacerViewManager.m +0 -26
- package/lib/ios/reactnativeuilib.xcodeproj/project.pbxproj +0 -435
- package/metro.config.js +0 -23
- package/src/.babelrc.json +0 -23
- package/src/assets/Assets.d.ts +0 -5
- package/src/assets/emojis/index.d.ts +0 -1343
- package/src/assets/index.d.ts +0 -3
- package/src/assets/internal/index.d.ts +0 -4
- package/src/commons/Config.d.ts +0 -24
- package/src/commons/Constants.d.ts +0 -54
- package/src/commons/UIComponent.d.ts +0 -4
- package/src/commons/asBaseComponent.d.ts +0 -15
- package/src/commons/baseComponent.d.ts +0 -2
- package/src/commons/forwardRef.d.ts +0 -8
- package/src/commons/modifiers.d.ts +0 -118
- package/src/commons/new.d.ts +0 -8
- package/src/commons/withScrollEnabler.d.ts +0 -13
- package/src/commons/withScrollReached.d.ts +0 -35
- package/src/components/WheelPicker/Item.d.ts +0 -28
- package/src/components/WheelPicker/WheelPicker.driver.d.ts +0 -18
- package/src/components/WheelPicker/WheelPickerItem.driver.d.ts +0 -8
- package/src/components/WheelPicker/helpers/useListMiddleIndex.d.ts +0 -6
- package/src/components/WheelPicker/index.d.ts +0 -88
- package/src/components/WheelPicker/types.d.ts +0 -6
- package/src/components/WheelPicker/usePresenter.d.ts +0 -21
- package/src/components/actionBar/index.d.ts +0 -35
- package/src/components/actionSheet/index.d.ts +0 -80
- package/src/components/animatedImage/index.d.ts +0 -28
- package/src/components/avatar/index.d.ts +0 -382
- package/src/components/badge/index.d.ts +0 -879
- package/src/components/baseInput/Validators.d.ts +0 -8
- package/src/components/baseInput/index.d.ts +0 -29
- package/src/components/button/Button.driver.new.d.ts +0 -34
- package/src/components/button/ButtonConstants.d.ts +0 -26
- package/src/components/button/index.d.ts +0 -572
- package/src/components/button/types.d.ts +0 -153
- package/src/components/card/CardContext.d.ts +0 -3
- package/src/components/card/CardImage.d.ts +0 -20
- package/src/components/card/CardPresenter.d.ts +0 -12
- package/src/components/card/CardSection.d.ts +0 -79
- package/src/components/card/asCardChild.d.ts +0 -6
- package/src/components/card/index.d.ts +0 -120
- package/src/components/carousel/Carousel.driver.new.d.ts +0 -9
- package/src/components/carousel/CarouselPresenter.d.ts +0 -9
- package/src/components/carousel/index.d.ts +0 -73
- package/src/components/carousel/types.d.ts +0 -107
- package/src/components/checkbox/Checkbox.driver.d.ts +0 -15
- package/src/components/checkbox/index.d.ts +0 -129
- package/src/components/chip/chip.driver.d.ts +0 -33
- package/src/components/chip/index.d.ts +0 -209
- package/src/components/chipsInput/index.d.ts +0 -55
- package/src/components/colorPalette/index.d.ts +0 -116
- package/src/components/colorPicker/ColorPickerDialog.d.ts +0 -39
- package/src/components/colorPicker/ColorPickerDialogHeader.d.ts +0 -9
- package/src/components/colorPicker/ColorPickerDialogSliders.d.ts +0 -10
- package/src/components/colorPicker/ColorPickerPresenter.d.ts +0 -16
- package/src/components/colorPicker/ColorPickerPreview.d.ts +0 -12
- package/src/components/colorPicker/index.d.ts +0 -45
- package/src/components/colorSwatch/index.d.ts +0 -50
- package/src/components/connectionStatusBar/index.d.ts +0 -33
- package/src/components/connectionStatusBar/types.d.ts +0 -28
- package/src/components/dash/index.d.ts +0 -19
- package/src/components/dateTimePicker/DateTimePicker.driver.d.ts +0 -7
- package/src/components/dateTimePicker/index.d.ts +0 -288
- package/src/components/dateTimePicker/useOldApi.d.ts +0 -27
- package/src/components/dialog/Dialog.driver.new.d.ts +0 -6
- package/src/components/dialog/DialogHeader.d.ts +0 -4
- package/src/components/dialog/index.d.ts +0 -15
- package/src/components/dialog/types.d.ts +0 -138
- package/src/components/dialog/useDialogContent.d.ts +0 -13
- package/src/components/drawer/Swipeable.d.ts +0 -94
- package/src/components/drawer/index.d.ts +0 -161
- package/src/components/expandableSection/index.d.ts +0 -40
- package/src/components/fadedScrollView/index.d.ts +0 -59
- package/src/components/fader/index.d.ts +0 -37
- package/src/components/featureHighlight/index.d.ts +0 -147
- package/src/components/floatingButton/index.d.ts +0 -85
- package/src/components/gradient/index.d.ts +0 -19
- package/src/components/gridList/index.d.ts +0 -5
- package/src/components/gridList/types.d.ts +0 -29
- package/src/components/gridList/useGridLayout.d.ts +0 -15
- package/src/components/gridListItem/index.d.ts +0 -132
- package/src/components/gridView/index.d.ts +0 -80
- package/src/components/hint/Hint.driver.d.ts +0 -6
- package/src/components/hint/Hint.driver.new.d.ts +0 -19
- package/src/components/hint/HintAnchor.d.ts +0 -13
- package/src/components/hint/HintBubble.d.ts +0 -12
- package/src/components/hint/HintMockChildren.d.ts +0 -8
- package/src/components/hint/HintOld.d.ts +0 -196
- package/src/components/hint/hooks/useHintAccessibility.d.ts +0 -10
- package/src/components/hint/hooks/useHintLayout.d.ts +0 -13
- package/src/components/hint/hooks/useHintPosition.d.ts +0 -29
- package/src/components/hint/hooks/useHintVisibility.d.ts +0 -6
- package/src/components/hint/index.d.ts +0 -14
- package/src/components/hint/types.d.ts +0 -106
- package/src/components/icon/index.d.ts +0 -97
- package/src/components/image/Image.driver.d.ts +0 -4
- package/src/components/image/Image.driver.new.d.ts +0 -2
- package/src/components/image/index.d.ts +0 -192
- package/src/components/listItem/ListItemPart.d.ts +0 -15
- package/src/components/listItem/index.d.ts +0 -52
- package/src/components/listItem/types.d.ts +0 -60
- package/src/components/loaderScreen/index.d.ts +0 -13
- package/src/components/loaderScreen/types.d.ts +0 -32
- package/src/components/marquee/index.d.ts +0 -5
- package/src/components/marquee/types.d.ts +0 -35
- package/src/components/maskedInput/index.d.ts +0 -5
- package/src/components/maskedInput/new.d.ts +0 -22
- package/src/components/modal/Modal.driver.new.d.ts +0 -8
- package/src/components/modal/TopBar.d.ts +0 -89
- package/src/components/modal/index.d.ts +0 -64
- package/src/components/numberInput/NumberInput.driver.d.ts +0 -6
- package/src/components/numberInput/Presenter.d.ts +0 -21
- package/src/components/numberInput/index.d.ts +0 -57
- package/src/components/overlay/index.d.ts +0 -68
- package/src/components/pageControl/index.d.ts +0 -56
- package/src/components/panView/index.d.ts +0 -21
- package/src/components/panView/panningUtil.d.ts +0 -38
- package/src/components/panView/usePanGesture.d.ts +0 -49
- package/src/components/picker/Picker.driver.new.d.ts +0 -44
- package/src/components/picker/PickerContext.d.ts +0 -4
- package/src/components/picker/PickerItem.d.ts +0 -11
- package/src/components/picker/PickerItemsList.d.ts +0 -4
- package/src/components/picker/PickerPresenter.d.ts +0 -7
- package/src/components/picker/PickerSelectionStatusBar.d.ts +0 -3
- package/src/components/picker/helpers/useFieldType.d.ts +0 -373
- package/src/components/picker/helpers/useImperativePickerHandle.d.ts +0 -5
- package/src/components/picker/helpers/useNewPickerProps.d.ts +0 -3
- package/src/components/picker/helpers/usePickerLabel.d.ts +0 -17
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +0 -4
- package/src/components/picker/helpers/usePickerSearch.d.ts +0 -9
- package/src/components/picker/helpers/usePickerSelection.d.ts +0 -16
- package/src/components/picker/index.d.ts +0 -15
- package/src/components/picker/types.d.ts +0 -321
- package/src/components/pieChart/PieSegment.d.ts +0 -34
- package/src/components/pieChart/index.d.ts +0 -15
- package/src/components/progressBar/index.d.ts +0 -65
- package/src/components/progressiveImage/index.d.ts +0 -23
- package/src/components/radioButton/RadioButton.driver.d.ts +0 -9
- package/src/components/radioButton/index.d.ts +0 -121
- package/src/components/radioGroup/RadioGroup.driver.d.ts +0 -13
- package/src/components/radioGroup/RadioGroupContext.d.ts +0 -14
- package/src/components/radioGroup/asRadioGroupChild.d.ts +0 -2
- package/src/components/radioGroup/index.d.ts +0 -47
- package/src/components/scrollBar/index.d.ts +0 -88
- package/src/components/searchInput/index.d.ts +0 -37
- package/src/components/searchInput/types.d.ts +0 -66
- package/src/components/sectionsWheelPicker/SectionsWheelPicker.driver.d.ts +0 -25
- package/src/components/sectionsWheelPicker/index.d.ts +0 -43
- package/src/components/segmentedControl/index.d.ts +0 -90
- package/src/components/segmentedControl/segment.d.ts +0 -111
- package/src/components/segmentedControl/useSegmentedControlPreset.d.ts +0 -10
- package/src/components/skeletonView/index.d.ts +0 -163
- package/src/components/slider/ColorSliderGroup.d.ts +0 -13
- package/src/components/slider/GradientSlider.d.ts +0 -20
- package/src/components/slider/SliderContext.d.ts +0 -8
- package/src/components/slider/Thumb.d.ts +0 -32
- package/src/components/slider/index.d.ts +0 -31
- package/src/components/slider/slider.driver.d.ts +0 -5
- package/src/components/slider/types.d.ts +0 -197
- package/src/components/sortableGridList/SortableItem.d.ts +0 -6
- package/src/components/sortableGridList/index.d.ts +0 -5
- package/src/components/sortableGridList/types.d.ts +0 -34
- package/src/components/sortableGridList/usePresenter.d.ts +0 -21
- package/src/components/sortableList/SortableList.driver.new.d.ts +0 -2
- package/src/components/sortableList/SortableListContext.d.ts +0 -19
- package/src/components/sortableList/SortableListItem.d.ts +0 -8
- package/src/components/sortableList/SortableListItem.driver.new.d.ts +0 -11
- package/src/components/sortableList/index.d.ts +0 -5
- package/src/components/sortableList/types.d.ts +0 -48
- package/src/components/sortableList/usePresenter.d.ts +0 -12
- package/src/components/stackAggregator/index.d.ts +0 -89
- package/src/components/stateScreen/index.d.ts +0 -5
- package/src/components/stateScreen/types.d.ts +0 -30
- package/src/components/stepper/index.d.ts +0 -47
- package/src/components/svgImage/index.d.ts +0 -14
- package/src/components/svgImage/index.web.d.ts +0 -18
- package/src/components/switch/index.d.ts +0 -102
- package/src/components/switch/switch.driver.d.ts +0 -18
- package/src/components/tabController/PageCarousel.d.ts +0 -9
- package/src/components/tabController/TabBar.d.ts +0 -97
- package/src/components/tabController/TabBarContext.d.ts +0 -18
- package/src/components/tabController/TabBarItem.d.ts +0 -105
- package/src/components/tabController/TabPage.d.ts +0 -33
- package/src/components/tabController/index.d.ts +0 -48
- package/src/components/tabController/useImperativeTabControllerHandle.d.ts +0 -6
- package/src/components/tabController/useScrollToItem.d.ts +0 -79
- package/src/components/text/Text.driver.d.ts +0 -7
- package/src/components/text/Text.driver.new.d.ts +0 -17
- package/src/components/text/index.d.ts +0 -195
- package/src/components/textField/CharCounter.d.ts +0 -7
- package/src/components/textField/ClearButton.d.ts +0 -4
- package/src/components/textField/FieldContext.d.ts +0 -4
- package/src/components/textField/FloatingPlaceholder.d.ts +0 -7
- package/src/components/textField/Input.d.ts +0 -8
- package/src/components/textField/Label.d.ts +0 -7
- package/src/components/textField/Presenter.d.ts +0 -7
- package/src/components/textField/TextField.driver.new.d.ts +0 -129
- package/src/components/textField/ValidationMessage.d.ts +0 -7
- package/src/components/textField/index.d.ts +0 -114
- package/src/components/textField/presets/outline.d.ts +0 -737
- package/src/components/textField/presets/underline.d.ts +0 -735
- package/src/components/textField/textInput/index.d.ts +0 -1
- package/src/components/textField/textInput/index.web.d.ts +0 -3
- package/src/components/textField/types.d.ts +0 -287
- package/src/components/textField/useFieldState.d.ts +0 -16
- package/src/components/textField/useImperativeInputHandle.d.ts +0 -4
- package/src/components/textField/usePreset.d.ts +0 -1696
- package/src/components/textField/validators.d.ts +0 -9
- package/src/components/textFieldOld/index.d.ts +0 -71
- package/src/components/timeline/Line.d.ts +0 -10
- package/src/components/timeline/Point.d.ts +0 -9
- package/src/components/timeline/index.d.ts +0 -11
- package/src/components/timeline/line.driver.d.ts +0 -10
- package/src/components/timeline/point.driver.d.ts +0 -8
- package/src/components/timeline/timeline.driver.d.ts +0 -25
- package/src/components/timeline/types.d.ts +0 -50
- package/src/components/touchableOpacity/index.d.ts +0 -50
- package/src/components/view/View.driver.new.d.ts +0 -7
- package/src/components/view/index.d.ts +0 -46
- package/src/components/wizard/WizardStates.d.ts +0 -2
- package/src/components/wizard/WizardStep.d.ts +0 -4
- package/src/components/wizard/index.d.ts +0 -31
- package/src/components/wizard/types.d.ts +0 -90
- package/src/helpers/AvatarHelper.d.ts +0 -9
- package/src/helpers/FormattingPresenter.d.ts +0 -6
- package/src/helpers/Profiler.d.ts +0 -22
- package/src/helpers/index.d.ts +0 -3
- package/src/hooks/index.d.ts +0 -14
- package/src/hooks/useCombinedRefs/index.d.ts +0 -3
- package/src/hooks/useDebounce/index.d.ts +0 -5
- package/src/hooks/useDidUpdate/index.d.ts +0 -6
- package/src/hooks/useHiddenLocation/index.d.ts +0 -13
- package/src/hooks/useHiddenLocation/index.web.d.ts +0 -13
- package/src/hooks/useKeyboardHeight/index.d.ts +0 -5
- package/src/hooks/useMeasure/index.d.ts +0 -15
- package/src/hooks/useModifiers/index.d.ts +0 -3
- package/src/hooks/useOrientation/index.d.ts +0 -7
- package/src/hooks/useScrollEnabler/index.d.ts +0 -23
- package/src/hooks/useScrollReached/index.d.ts +0 -28
- package/src/hooks/useScrollTo/index.d.ts +0 -37
- package/src/hooks/useScrollToItem/index.d.ts +0 -65
- package/src/hooks/useThemeProps/index.d.ts +0 -2
- package/src/hooks/useToggleValue/index.d.ts +0 -2
- package/src/incubator/TouchableOpacity.d.ts +0 -52
- package/src/incubator/calendar/Agenda.d.ts +0 -4
- package/src/incubator/calendar/CalendarContext.d.ts +0 -4
- package/src/incubator/calendar/CalendarItem.d.ts +0 -5
- package/src/incubator/calendar/Day.d.ts +0 -4
- package/src/incubator/calendar/Day_OLD.d.ts +0 -4
- package/src/incubator/calendar/Header.d.ts +0 -4
- package/src/incubator/calendar/Month.d.ts +0 -4
- package/src/incubator/calendar/TodayButton.d.ts +0 -4
- package/src/incubator/calendar/Week.d.ts +0 -4
- package/src/incubator/calendar/WeekDaysNames.d.ts +0 -4
- package/src/incubator/calendar/helpers/CalendarProcessor.d.ts +0 -2
- package/src/incubator/calendar/helpers/DataProcessor.d.ts +0 -2
- package/src/incubator/calendar/helpers/DateUtils.d.ts +0 -23
- package/src/incubator/calendar/index.d.ts +0 -7
- package/src/incubator/calendar/types.d.ts +0 -118
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.d.ts +0 -7
- package/src/incubator/expandableOverlay/index.d.ts +0 -83
- package/src/incubator/gradient/BorderGradient.d.ts +0 -4
- package/src/incubator/gradient/CircleGradient.d.ts +0 -4
- package/src/incubator/gradient/RectangleGradient.d.ts +0 -4
- package/src/incubator/gradient/index.d.ts +0 -5
- package/src/incubator/gradient/types.d.ts +0 -26
- package/src/incubator/gradient/useAngleTransform.d.ts +0 -27
- package/src/incubator/index.d.ts +0 -9
- package/src/incubator/slider/Slider.driver.d.ts +0 -5
- package/src/incubator/slider/SliderPresenter.d.ts +0 -6
- package/src/incubator/slider/Thumb.d.ts +0 -24
- package/src/incubator/slider/Track.d.ts +0 -13
- package/src/incubator/slider/index.d.ts +0 -139
- package/src/incubator/toast/Toast.driver.new.d.ts +0 -54
- package/src/incubator/toast/helpers/useToastAnimation.d.ts +0 -22
- package/src/incubator/toast/helpers/useToastPresets.d.ts +0 -8
- package/src/incubator/toast/helpers/useToastTimer.d.ts +0 -6
- package/src/incubator/toast/index.d.ts +0 -9
- package/src/incubator/toast/types.d.ts +0 -111
- package/src/index.d.ts +0 -92
- package/src/optionalDependencies/BlurViewPackage.d.ts +0 -2
- package/src/optionalDependencies/BlurViewPackage.web.d.ts +0 -2
- package/src/optionalDependencies/DateTimePickerPackage.d.ts +0 -2
- package/src/optionalDependencies/FlashListPackage.d.ts +0 -2
- package/src/optionalDependencies/HapticFeedbackPackage.d.ts +0 -2
- package/src/optionalDependencies/LinearGradientPackage.d.ts +0 -2
- package/src/optionalDependencies/MomentPackage.d.ts +0 -2
- package/src/optionalDependencies/NetInfoPackage.d.ts +0 -2
- package/src/optionalDependencies/PostCssPackage.d.ts +0 -5
- package/src/optionalDependencies/ShimmerPackage.d.ts +0 -2
- package/src/optionalDependencies/SvgPackage.d.ts +0 -3
- package/src/optionalDependencies/index.d.ts +0 -9
- package/src/optionalDependencies/index.web.d.ts +0 -7
- package/src/services/HapticService.d.ts +0 -15
- package/src/services/LogService.d.ts +0 -35
- package/src/services/index.d.ts +0 -2
- package/src/style/borderRadiuses.d.ts +0 -30
- package/src/style/colorName.d.ts +0 -8
- package/src/style/colorNameMap.d.ts +0 -2
- package/src/style/colors.d.ts +0 -274
- package/src/style/colorsPalette.d.ts +0 -101
- package/src/style/components.d.ts +0 -15
- package/src/style/componentsColors.d.ts +0 -5
- package/src/style/designTokens.d.ts +0 -69
- package/src/style/designTokensDM.d.ts +0 -69
- package/src/style/dividers.d.ts +0 -11
- package/src/style/index.d.ts +0 -13
- package/src/style/scheme.d.ts +0 -57
- package/src/style/shadows.d.ts +0 -223
- package/src/style/spacings.d.ts +0 -32
- package/src/style/themeManager.d.ts +0 -22
- package/src/style/typography.d.ts +0 -26
- package/src/style/typographyPresets.d.ts +0 -7
- package/src/testkit/Component.driver.d.ts +0 -30
- package/src/testkit/DriverException.d.ts +0 -12
- package/src/testkit/UniDriver.d.ts +0 -29
- package/src/testkit/drivers/TestingLibraryDriver.d.ts +0 -26
- package/src/testkit/index.d.ts +0 -25
- package/src/testkit/new/Component.driver.d.ts +0 -16
- package/src/testkit/new/useDraggable.driver.d.ts +0 -15
- package/src/testkit/new/usePressable.driver.d.ts +0 -14
- package/src/testkit/new/useScrollable.driver.d.ts +0 -13
- package/src/typings/assets.d.ts +0 -52
- package/src/typings/common.d.ts +0 -12
- package/src/typings/module.d.ts +0 -13
- package/src/typings/recorderTypes.d.ts +0 -13
- package/src/uilib-test-renderer/helper.d.ts +0 -8
- package/src/uilib-test-renderer/index.d.ts +0 -4
- package/src/uilib-test-renderer/scrollViewHelper.d.ts +0 -9
- package/src/utils/dateUtils.d.ts +0 -2
- package/src/utils/imageUtils.d.ts +0 -5
- package/src/utils/index.d.ts +0 -4
- package/src/utils/styleUtils.d.ts +0 -7
- package/src/utils/textUtils.d.ts +0 -8
- /package/{src → scripts/build}/.babelrc.exports.js +0 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react-native';
|
|
3
|
+
import { TimelineDriver } from "../timeline.driver";
|
|
4
|
+
import Timeline from "../index";
|
|
5
|
+
import Text from "../../text";
|
|
6
|
+
import Assets from "../../../assets";
|
|
7
|
+
const testID = 'test-timeline';
|
|
8
|
+
const labelContent = 2;
|
|
9
|
+
const defaultIcon = Assets.internal.icons.check;
|
|
10
|
+
const getDriver = props => {
|
|
11
|
+
const renderTree = render(<Timeline testID={testID} {...props}>
|
|
12
|
+
<Text>Timeline</Text>
|
|
13
|
+
</Timeline>);
|
|
14
|
+
return TimelineDriver({
|
|
15
|
+
renderTree,
|
|
16
|
+
testID
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
describe('Timeline', () => {
|
|
20
|
+
describe('sanity', () => {
|
|
21
|
+
it('should render Timeline', () => {
|
|
22
|
+
const timelineDriver = getDriver();
|
|
23
|
+
expect(timelineDriver.exists()).toBeTruthy();
|
|
24
|
+
expect(timelineDriver.getPoint().exists()).toBeTruthy();
|
|
25
|
+
expect(timelineDriver.getTopLine().exists()).toBeTruthy();
|
|
26
|
+
expect(timelineDriver.getTopLine().isVisible()).toBeFalsy();
|
|
27
|
+
expect(timelineDriver.getBottomLine().exists()).toBeFalsy();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('Point', () => {
|
|
31
|
+
describe('with Icon', () => {
|
|
32
|
+
it('should override icon color when passing iconProps.tintColor', () => {
|
|
33
|
+
const props = {
|
|
34
|
+
point: {
|
|
35
|
+
icon: defaultIcon,
|
|
36
|
+
iconProps: {
|
|
37
|
+
tintColor: '#A2387E'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const timelineDriver = getDriver(props);
|
|
42
|
+
const contentStyle = timelineDriver.getPoint().getContentStyle();
|
|
43
|
+
expect(contentStyle.tintColor).toEqual('#A2387E');
|
|
44
|
+
expect(contentStyle.color).toBeUndefined();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('with Label', () => {
|
|
48
|
+
it('should override label color when passing labelColor', () => {
|
|
49
|
+
const props = {
|
|
50
|
+
point: {
|
|
51
|
+
label: labelContent,
|
|
52
|
+
labelColor: '#A2387E'
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const timelineDriver = getDriver(props);
|
|
56
|
+
const contentStyle = timelineDriver.getPoint().getContentStyle();
|
|
57
|
+
expect(contentStyle.color).toEqual('#A2387E');
|
|
58
|
+
expect(contentStyle.tintColor).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
it('should render Icon when icon and label passed', () => {
|
|
62
|
+
const props = {
|
|
63
|
+
point: {
|
|
64
|
+
icon: defaultIcon,
|
|
65
|
+
iconProps: {
|
|
66
|
+
tintColor: '#A2387E'
|
|
67
|
+
},
|
|
68
|
+
label: labelContent
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const timelineDriver = getDriver(props);
|
|
72
|
+
const contentStyle = timelineDriver.getPoint().getContentStyle();
|
|
73
|
+
expect(contentStyle.tintColor).toEqual('#A2387E');
|
|
74
|
+
expect(contentStyle.color).toBeUndefined();
|
|
75
|
+
});
|
|
76
|
+
it('tintColor and color should be undefined when icon and label are not passed', () => {
|
|
77
|
+
const timelineDriver = getDriver();
|
|
78
|
+
const contentStyle = timelineDriver.getPoint().getContentStyle();
|
|
79
|
+
expect(contentStyle.tintColor).toBeUndefined();
|
|
80
|
+
expect(contentStyle.color).toBeUndefined();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('TopLine', () => {
|
|
84
|
+
it('should override top line color and width', () => {
|
|
85
|
+
const props = {
|
|
86
|
+
topLine: {
|
|
87
|
+
color: '#00A87E',
|
|
88
|
+
width: 3
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const timelineDriver = getDriver(props);
|
|
92
|
+
const topLine = timelineDriver.getTopLine();
|
|
93
|
+
expect(topLine.exists()).toBeTruthy();
|
|
94
|
+
const topLineStyle = topLine.getStyle();
|
|
95
|
+
expect(topLineStyle.backgroundColor).toEqual('#00A87E');
|
|
96
|
+
expect(topLineStyle.width).toEqual(3);
|
|
97
|
+
});
|
|
98
|
+
it('should render line with entryPoint', () => {
|
|
99
|
+
const props = {
|
|
100
|
+
topLine: {
|
|
101
|
+
entry: true
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const timelineDriver = getDriver(props);
|
|
105
|
+
const topLine = timelineDriver.getTopLine();
|
|
106
|
+
expect(topLine.isEntryPointExists()).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe('BottomLine', () => {
|
|
110
|
+
it('should render BottomLine', () => {
|
|
111
|
+
const props = {
|
|
112
|
+
bottomLine: {}
|
|
113
|
+
};
|
|
114
|
+
const timelineDriver = getDriver(props);
|
|
115
|
+
const bottomLine = timelineDriver.getBottomLine();
|
|
116
|
+
expect(bottomLine.exists()).toBeTruthy();
|
|
117
|
+
});
|
|
118
|
+
it('should override bottom line color and width', () => {
|
|
119
|
+
const props = {
|
|
120
|
+
bottomLine: {
|
|
121
|
+
color: '#FFF4D3',
|
|
122
|
+
width: 5
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const timelineDriver = getDriver(props);
|
|
126
|
+
const bottomLine = timelineDriver.getBottomLine();
|
|
127
|
+
expect(bottomLine.exists()).toBeTruthy();
|
|
128
|
+
const bottomLineStyle = bottomLine.getStyle();
|
|
129
|
+
expect(bottomLineStyle.backgroundColor).toEqual('#FFF4D3');
|
|
130
|
+
expect(bottomLineStyle.width).toEqual(5);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {Colors, Typography} from '../../../src/style';
|
|
2
|
+
|
|
3
|
+
describe('services/AvatarService', () => {
|
|
4
|
+
let uut;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
uut = require('../../../src/helpers/AvatarHelper');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should getInitialsTypography', () => {
|
|
10
|
+
expect(uut.getInitialsTypography(12)).toEqual({fontSize: 10});
|
|
11
|
+
expect(uut.getInitialsTypography(16)).toEqual({fontSize: 10});
|
|
12
|
+
expect(uut.getInitialsTypography(20)).toEqual({fontSize: 10});
|
|
13
|
+
expect(uut.getInitialsTypography(28)).toEqual(Typography.text90BO);
|
|
14
|
+
expect(uut.getInitialsTypography(40)).toEqual(Typography.text80BO);
|
|
15
|
+
expect(uut.getInitialsTypography(48)).toEqual(Typography.text80BO);
|
|
16
|
+
expect(uut.getInitialsTypography(60)).toEqual(Typography.text60BO);
|
|
17
|
+
expect(uut.getInitialsTypography(80)).toEqual(Typography.text50H);
|
|
18
|
+
expect(uut.getInitialsTypography(120)).toEqual(Typography.text40H);
|
|
19
|
+
expect(uut.getInitialsTypography(200)).toEqual(Typography.text40H);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should getAvatarColors', () => {
|
|
23
|
+
const avatarColors = uut.getAvatarColors();
|
|
24
|
+
expect(avatarColors).toEqual([
|
|
25
|
+
Colors.blue20,
|
|
26
|
+
Colors.cyan20,
|
|
27
|
+
Colors.green20,
|
|
28
|
+
Colors.yellow20,
|
|
29
|
+
Colors.orange20,
|
|
30
|
+
Colors.red20,
|
|
31
|
+
Colors.purple20,
|
|
32
|
+
Colors.violet20
|
|
33
|
+
]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should getColorById', () => {
|
|
37
|
+
const avatarColors = uut.getAvatarColors();
|
|
38
|
+
expect(uut.getColorById(null)).toBe(avatarColors[0]);
|
|
39
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f48')).toBe(avatarColors[0]);
|
|
40
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f47')).toBe(avatarColors[1]);
|
|
41
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f46')).toBe(avatarColors[2]);
|
|
42
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f45')).toBe(avatarColors[3]);
|
|
43
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f44')).toBe(avatarColors[4]);
|
|
44
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f43')).toBe(avatarColors[5]);
|
|
45
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f42')).toBe(avatarColors[6]);
|
|
46
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f49')).toBe(avatarColors[7]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should getColorById with custom array of colors', () => {
|
|
50
|
+
const customColors = [Colors.blue10, Colors.red10, Colors.orange10];
|
|
51
|
+
expect(uut.getColorById(null, customColors)).toBe(customColors[0]);
|
|
52
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f48', customColors)).toBe(customColors[1]);
|
|
53
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f47', customColors)).toBe(customColors[2]);
|
|
54
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f46', customColors)).toBe(customColors[0]);
|
|
55
|
+
expect(uut.getColorById('a19c0ee3-c165-434e-bf4d-a6c218c83f45', customColors)).toBe(customColors[1]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should getInitials', () => {
|
|
59
|
+
expect(uut.getInitials('Austin Guerrero')).toBe('AG');
|
|
60
|
+
expect(uut.getInitials('Austin Guerrero', 1)).toBe('A');
|
|
61
|
+
expect(uut.getInitials('Austin Guerrero', 2)).toBe('AG');
|
|
62
|
+
expect(uut.getInitials('Austin Guerrero', 3)).toBe('AG');
|
|
63
|
+
expect(uut.getInitials('Austin Guerrero')).toBe('AG');
|
|
64
|
+
expect(uut.getInitials('theresa simpson')).toBe('TS');
|
|
65
|
+
expect(uut.getInitials('theresa simpson', 1)).toBe('T');
|
|
66
|
+
expect(uut.getInitials('theresa simpson', 2)).toBe('TS');
|
|
67
|
+
expect(uut.getInitials('theresa simpson', 3)).toBe('TS');
|
|
68
|
+
expect(uut.getInitials('Sarah Michelle Galler')).toBe('SM');
|
|
69
|
+
expect(uut.getInitials('Sarah Michelle Galler', 1)).toBe('S');
|
|
70
|
+
expect(uut.getInitials('Sarah Michelle Galler', 2)).toBe('SM');
|
|
71
|
+
expect(uut.getInitials('Sarah Michelle Galler', 3)).toBe('SMG');
|
|
72
|
+
expect(uut.getInitials('Keith')).toBe('K');
|
|
73
|
+
expect(uut.getInitials()).toBe('');
|
|
74
|
+
expect(uut.getInitials(' Austin ')).toBe('A');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should getBackgroundColor', () => {
|
|
78
|
+
const avatarColors = uut.getAvatarColors();
|
|
79
|
+
const hashFunction = uut.hashStringToNumber;
|
|
80
|
+
const defaultColor = Colors.grey80;
|
|
81
|
+
expect(uut.getBackgroundColor('', avatarColors, hashFunction, defaultColor)).toBe(defaultColor);
|
|
82
|
+
expect(uut.getBackgroundColor(undefined, avatarColors, hashFunction, defaultColor)).toBe(defaultColor);
|
|
83
|
+
expect(uut.getBackgroundColor(null, avatarColors, hashFunction, defaultColor)).toBe(defaultColor);
|
|
84
|
+
expect(uut.getBackgroundColor('Austin Guerrero', undefined, hashFunction, defaultColor)).toBe(defaultColor);
|
|
85
|
+
expect(uut.getBackgroundColor('Austin Guerrero', null, hashFunction, defaultColor)).toBe(defaultColor);
|
|
86
|
+
expect(uut.getBackgroundColor('Austin Guerrero', avatarColors, undefined, defaultColor)).toBe(defaultColor);
|
|
87
|
+
expect(uut.getBackgroundColor('Austin Guerrero', avatarColors, null, defaultColor)).toBe(defaultColor);
|
|
88
|
+
expect(uut.getBackgroundColor('Austin Guerrero', avatarColors, hashFunction, defaultColor)).toBe(Colors.orange20);
|
|
89
|
+
expect(uut.getBackgroundColor('theresa simpson', avatarColors, hashFunction, defaultColor)).toBe(Colors.green20);
|
|
90
|
+
expect(uut.getBackgroundColor('Sarah Michelle Galler', avatarColors, hashFunction, defaultColor)).toBe(Colors.green20);
|
|
91
|
+
expect(uut.getBackgroundColor('Keith', avatarColors, hashFunction, defaultColor)).toBe(Colors.green20);
|
|
92
|
+
expect(uut.getBackgroundColor(' Austin ', avatarColors, hashFunction, defaultColor)).toBe(Colors.cyan20);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('Is-gravatar query function', () => {
|
|
96
|
+
it('should return true for a valid (known) gravatar url', () => {
|
|
97
|
+
expect(uut.isGravatarUrl('https://www.gravatar.com/avatar/00000000000000000000000000000000')).toEqual(true);
|
|
98
|
+
expect(uut.isGravatarUrl('http://www.gravatar.com/avatar/00000000000000000000000000000000')).toEqual(true);
|
|
99
|
+
expect(uut.isGravatarUrl('http://gravatar.com/avatar/00000000000000000000000000000000')).toEqual(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should return true for a gravatar-ish url', () => {
|
|
103
|
+
expect(uut.isGravatarUrl('http://gravatar.org/avatar/00000000000000000000000000000000')).toEqual(true);
|
|
104
|
+
expect(uut.isGravatarUrl('http://gravatar/avatar/00000000000000000000000000000000')).toEqual(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should return false for a url with a broken path', () => {
|
|
108
|
+
expect(uut.isGravatarUrl('https://www.gravatar.com')).toEqual(false);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('should return false for a non-gravatar url', () => {
|
|
112
|
+
expect(uut.isGravatarUrl('https://www._gravatar.com/avatar/00000000000000000000000000000000')).toEqual(false);
|
|
113
|
+
expect(uut.isGravatarUrl('https://www.avatar.com/avatar/00000000000000000000000000000000')).toEqual(false);
|
|
114
|
+
expect(uut.isGravatarUrl('https://www.gravatars.com/avatar/00000000000000000000000000000000')).toEqual(false);
|
|
115
|
+
expect(uut.isGravatarUrl('https://www.grava.tar/avatar/00000000000000000000000000000000')).toEqual(false);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('isBlankGravatarUrl', () => {
|
|
120
|
+
it('should return false if the url does not contain the blank param', () => {
|
|
121
|
+
expect(uut.isBlankGravatarUrl('https://www.gravatar.com/avatar/00000000000000000000000000000000')).toEqual(false);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should return true if the url contains the blank param', () => {
|
|
125
|
+
expect(uut.isBlankGravatarUrl('https://www.gravatar.com/avatar/00000000000000000000000000000000?d=blank')).toEqual(true);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should return false if it is not a gravatar url', () => {
|
|
129
|
+
expect(uut.isBlankGravatarUrl('https://some/random/url/avatar/000000000?d=blank')).toEqual(false);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('Patch-fix function', () => {
|
|
134
|
+
const gravatarUrl = 'https://www.gravatar.com/avatar/00000000000000000000000000000000';
|
|
135
|
+
const shortGravatarUrl = 'https://gravatar.com/avatar/00000000000000000000000000000000';
|
|
136
|
+
|
|
137
|
+
it('should be applied for valid gravatar links without a default url-param', () => {
|
|
138
|
+
expect(uut.patchGravatarUrl(gravatarUrl)).toEqual(`${gravatarUrl}?d=404`);
|
|
139
|
+
expect(uut.patchGravatarUrl(shortGravatarUrl)).toEqual(`${shortGravatarUrl}?d=404`);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('should be applied for valid gravatar links with an existing default url-param', () => {
|
|
143
|
+
const url = `${gravatarUrl}?d=mock`;
|
|
144
|
+
const urlShort = `${shortGravatarUrl}?d=mock`;
|
|
145
|
+
expect(uut.patchGravatarUrl(url)).toEqual(`${gravatarUrl}?d=404`);
|
|
146
|
+
expect(uut.patchGravatarUrl(urlShort)).toEqual(`${shortGravatarUrl}?d=404`);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should be applied for valid gravatar links with an existing default url-param and a hash', () => {
|
|
150
|
+
const url = `${gravatarUrl}?d=mock#hash-mock`;
|
|
151
|
+
const urlShort = `${shortGravatarUrl}?d=mock#hash-mock`;
|
|
152
|
+
expect(uut.patchGravatarUrl(url)).toEqual(`${gravatarUrl}?d=404#hash-mock`);
|
|
153
|
+
expect(uut.patchGravatarUrl(urlShort)).toEqual(`${shortGravatarUrl}?d=404#hash-mock`);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should be applied for valid gravatar links with both short- and longhand default url-param', () => {
|
|
157
|
+
const url = `${gravatarUrl}?d=mock&default=mock-long`;
|
|
158
|
+
const urlShort = `${shortGravatarUrl}?d=mock&default=mock-long`;
|
|
159
|
+
expect(uut.patchGravatarUrl(url)).toEqual(`${gravatarUrl}?d=404`);
|
|
160
|
+
expect(uut.patchGravatarUrl(urlShort)).toEqual(`${shortGravatarUrl}?d=404`);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should keep existing non-default params', () => {
|
|
164
|
+
const url = `${gravatarUrl}?d=mock&mock1=param1&mock2=param2`;
|
|
165
|
+
const urlShort = `${shortGravatarUrl}?d=mock&mock1=param1&mock2=param2`;
|
|
166
|
+
expect(uut.patchGravatarUrl(url)).toEqual(`${gravatarUrl}?d=404&mock1=param1&mock2=param2`);
|
|
167
|
+
expect(uut.patchGravatarUrl(urlShort)).toEqual(`${shortGravatarUrl}?d=404&mock1=param1&mock2=param2`);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {renderHook} from '@testing-library/react-hooks';
|
|
2
|
+
import useDidUpdate from '../index';
|
|
3
|
+
|
|
4
|
+
describe('useDidUpdate hook tests', () => {
|
|
5
|
+
it('Expect action to not be called when the dependencies array value hasn\'t change', () => {
|
|
6
|
+
const action = jest.fn();
|
|
7
|
+
const dependencies = [false, 'false'];
|
|
8
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
9
|
+
|
|
10
|
+
rerender();
|
|
11
|
+
rerender();
|
|
12
|
+
rerender();
|
|
13
|
+
expect(action.mock.calls.length).toBe(0);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('Expect action to be called when dependencies array has change', () => {
|
|
17
|
+
const action = jest.fn();
|
|
18
|
+
let dependencies = [false, 'YES YES', 1];
|
|
19
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
20
|
+
|
|
21
|
+
dependencies = [false, 'NO NO', 1];
|
|
22
|
+
rerender();
|
|
23
|
+
expect(action.mock.calls.length).toBe(1);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('Expect action to be called when dependencies array has change', () => {
|
|
27
|
+
const action = jest.fn();
|
|
28
|
+
let dependencies = [false, 'YES YES', 1];
|
|
29
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
30
|
+
|
|
31
|
+
dependencies = [false, 'NO NO', 1];
|
|
32
|
+
rerender();
|
|
33
|
+
expect(action.mock.calls.length).toBe(1);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('Expect action to be called when dependencies array has change', () => {
|
|
37
|
+
const action = jest.fn();
|
|
38
|
+
let dependencies = [false, 'YES YES', 1];
|
|
39
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
40
|
+
|
|
41
|
+
dependencies = [false, 'NO NO', 1];
|
|
42
|
+
rerender();
|
|
43
|
+
expect(action.mock.calls.length).toBe(1);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('Expect action to be called when object value in dependencies array has change', () => {
|
|
47
|
+
const action = jest.fn();
|
|
48
|
+
let dependencies = [false, [1, 2], {name: 'AAA', address: {number: 10}}];
|
|
49
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
50
|
+
|
|
51
|
+
dependencies = [false, [1, 2], {name: 'BBB'}];
|
|
52
|
+
rerender();
|
|
53
|
+
expect(action.mock.calls.length).toBe(1);
|
|
54
|
+
|
|
55
|
+
dependencies = [false, [1, 2], {name: 'AAA', address: {number: 20}}];
|
|
56
|
+
rerender();
|
|
57
|
+
expect(action.mock.calls.length).toBe(2);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('Expect action to be called when value in array dependencies array has change', () => {
|
|
61
|
+
const action = jest.fn();
|
|
62
|
+
let dependencies = [false, [1, [2]], {name: 'AAA'}];
|
|
63
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
64
|
+
|
|
65
|
+
dependencies = [false, [1, [3]], {name: 'AAA', address: {number: 20}}];
|
|
66
|
+
rerender();
|
|
67
|
+
expect(action.mock.calls.length).toBe(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('Expect action not to be called when value in array dependencies array has not change value just reference', () => {
|
|
71
|
+
const action = jest.fn();
|
|
72
|
+
let dependencies = [false];
|
|
73
|
+
const {rerender} = renderHook(() => useDidUpdate(action, dependencies));
|
|
74
|
+
|
|
75
|
+
dependencies = [false];
|
|
76
|
+
rerender();
|
|
77
|
+
expect(action.mock.calls.length).toBe(0);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {renderHook, act} from '@testing-library/react-hooks';
|
|
2
|
+
|
|
3
|
+
let Constants;
|
|
4
|
+
let useOrientation;
|
|
5
|
+
let orientationChangeListeners;
|
|
6
|
+
|
|
7
|
+
describe('useOrientation hook', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
jest.mock('../../../commons/Constants');
|
|
10
|
+
Constants = require('../../../commons/Constants').default;
|
|
11
|
+
useOrientation = require('../index').default;
|
|
12
|
+
|
|
13
|
+
orientationChangeListeners = [];
|
|
14
|
+
|
|
15
|
+
Constants.addDimensionsEventListener = jest.fn(callback => {
|
|
16
|
+
orientationChangeListeners.push(callback);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should return current orientation', () => {
|
|
21
|
+
act(() => {
|
|
22
|
+
fakeOrientationChange('landscape');
|
|
23
|
+
});
|
|
24
|
+
const {result} = renderHook(() => {
|
|
25
|
+
const {orientation} = useOrientation();
|
|
26
|
+
|
|
27
|
+
return {orientation};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
expect(result.current.orientation).toBe('landscape');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should update orientation when it change', () => {
|
|
34
|
+
act(() => {
|
|
35
|
+
fakeOrientationChange('landscape');
|
|
36
|
+
});
|
|
37
|
+
const {result} = renderHook(() => {
|
|
38
|
+
const {orientation} = useOrientation();
|
|
39
|
+
|
|
40
|
+
return {orientation};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
act(() => {
|
|
44
|
+
fakeOrientationChange('portrait');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect(result.current.orientation).toBe('portrait');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should invoke given change callback when orientation changes', () => {
|
|
51
|
+
const changeCallback = jest.fn();
|
|
52
|
+
renderHook(() => {
|
|
53
|
+
const {orientation} = useOrientation({onOrientationChange: changeCallback});
|
|
54
|
+
return {orientation};
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
act(() => {
|
|
58
|
+
fakeOrientationChange('landscape');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(changeCallback).toHaveBeenCalledTimes(1);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
function fakeOrientationChange(orientation = 'portrait') {
|
|
66
|
+
Constants.orientation = orientation;
|
|
67
|
+
orientationChangeListeners.forEach(callback => {
|
|
68
|
+
callback(orientation);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {renderHook, act} from '@testing-library/react-hooks';
|
|
2
|
+
import useToggleValue from '../index';
|
|
3
|
+
|
|
4
|
+
describe('useOrientation hook tests', () => {
|
|
5
|
+
const makeSUT = (initial, secondary) => {
|
|
6
|
+
return renderHook(() => {
|
|
7
|
+
return useToggleValue(initial, secondary);
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const getValue = (result) => {
|
|
12
|
+
return result.current[0];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getToggle = (result) => {
|
|
16
|
+
return result.current[1]();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const expectValueToToggle = (a, b) => {
|
|
20
|
+
const {result} = makeSUT(a, b);
|
|
21
|
+
expect(getValue(result)).toEqual(a);
|
|
22
|
+
|
|
23
|
+
act(() => getToggle(result));
|
|
24
|
+
expect(getValue(result)).toEqual(b);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
it('Initial value should be set', () => {
|
|
28
|
+
const {result} = makeSUT(true, false);
|
|
29
|
+
|
|
30
|
+
expect(getValue(result)).toEqual(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('Initial value can be undefined', () => {
|
|
34
|
+
const {result} = makeSUT(undefined, 'Sid');
|
|
35
|
+
expect(getValue(result)).toEqual(undefined);
|
|
36
|
+
|
|
37
|
+
act(() => getToggle(result));
|
|
38
|
+
expect(getValue(result)).toEqual('Sid');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('Initial value can be change', () => {
|
|
42
|
+
const {result} = makeSUT(true, false);
|
|
43
|
+
act(() => getToggle(result));
|
|
44
|
+
|
|
45
|
+
expect(getValue(result)).toEqual(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('Allow toggle boolean without passing a second parameter', () => {
|
|
49
|
+
const {result} = makeSUT(true);
|
|
50
|
+
act(() => getToggle(result));
|
|
51
|
+
|
|
52
|
+
expect(getValue(result)).toEqual(false);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('Can toggle strings', () => {
|
|
56
|
+
const a = 'Ohio';
|
|
57
|
+
const b = 'Texas';
|
|
58
|
+
|
|
59
|
+
expectValueToToggle(a, b);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('Can toggle numbers', () => {
|
|
63
|
+
const a = 30;
|
|
64
|
+
const b = 22;
|
|
65
|
+
|
|
66
|
+
expectValueToToggle(a, b);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('Can toggle arrays', () => {
|
|
70
|
+
const a = [1, 2, 3, 4];
|
|
71
|
+
const b = ['Booking', 'OneApp', 'Fed'];
|
|
72
|
+
|
|
73
|
+
expectValueToToggle(a, b);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('Can toggle objects', () => {
|
|
77
|
+
const a = {};
|
|
78
|
+
const b = {name: 'Darth', occupation: 'Father'};
|
|
79
|
+
|
|
80
|
+
expectValueToToggle(a, b);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('Can toggle different types', () => {
|
|
84
|
+
const a = 999;
|
|
85
|
+
const b = '999';
|
|
86
|
+
|
|
87
|
+
expectValueToToggle(a, b);
|
|
88
|
+
});
|
|
89
|
+
});
|