@eohjsc/react-native-smart-city 0.2.21 → 0.2.27
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/README.md +1 -1
- package/assets/images/Add.svg +5 -0
- package/assets/images/AddLocationMaps/Point.svg +3 -0
- package/assets/images/CheckCircle.svg +4 -0
- package/assets/images/Close.svg +3 -0
- package/assets/images/HowToStart.svg +14 -0
- package/assets/images/Illustrations.svg +83 -0
- package/assets/images/OneTap.svg +14 -0
- package/assets/images/OneTap@1x.svg +14 -0
- package/assets/images/Rearrange.svg +3 -0
- package/assets/images/Schedule.svg +39 -0
- package/assets/images/ValueChange.svg +49 -0
- package/index.js +2 -0
- package/package.json +14 -2
- package/src/Images/Common/ActiveButton.png +0 -0
- package/src/Images/Common/ActiveButton@2x.png +0 -0
- package/src/Images/Common/ActiveButton@3x.png +0 -0
- package/src/Images/Common/arrow-back.png +0 -0
- package/src/Images/Common/checked@2x.png +0 -0
- package/src/Images/Common/checked@3x.png +0 -0
- package/src/Images/Common/file.png +0 -0
- package/src/Images/Common/fullscreen.png +0 -0
- package/src/Images/Common/refresh.png +0 -0
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +1 -1
- package/src/commons/ActionGroup/OnOffTemplate/index.js +9 -4
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +4 -3
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate.js +13 -6
- package/src/commons/ActionGroup/ThreeButtonTemplateStyle.js +1 -1
- package/src/commons/ActionGroup/TimerActionTemplate.js +158 -33
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplate.test.js +294 -0
- package/src/commons/ActionGroup/__test__/NumberUpDownTemplateWithNullConfigValue.test.js +60 -0
- package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +8 -13
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +26 -45
- package/src/commons/ActionGroup/__test__/ThreeButtonTemplate.test.js +11 -5
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +14 -8
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +17 -23
- package/src/commons/ActionGroup/__test__/__snapshots__/ThreeButtonTemplate.test.js.snap +241 -223
- package/src/commons/ActionGroup/__test__/index.test.js +39 -107
- package/src/commons/ActionGroup/hooks/useDropdownAction.js +2 -1
- package/src/commons/ActionTemplate/ActionTemplateStyles.js +14 -0
- package/src/commons/ActionTemplate/OnOffButtonAction.js +40 -0
- package/src/commons/ActionTemplate/OnOffButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/OneButtonAction.js +26 -0
- package/src/commons/ActionTemplate/OneButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/ThreeButtonAction.js +55 -0
- package/src/commons/ActionTemplate/ThreeButtonActionStyles.js +11 -0
- package/src/commons/ActionTemplate/__test__/OnOffButtonAction.test.js +34 -0
- package/src/commons/ActionTemplate/__test__/OneButtonAction.test.js +33 -0
- package/src/commons/ActionTemplate/__test__/ThreeButtonAction.test.js +35 -0
- package/src/commons/ActionTemplate/__test__/index.test.js +71 -0
- package/src/commons/ActionTemplate/index.js +69 -0
- package/src/commons/AlertAction/__test__/AlertAction.test.js +6 -6
- package/src/commons/AlertAction/index.js +2 -0
- package/src/commons/Automate/ItemAddNewScriptActionStyles.js +38 -0
- package/src/commons/Automate/ItemAutomate.js +39 -0
- package/src/commons/Automate/ItemAutomateStyles.js +33 -0
- package/src/commons/Automate/ItemScriptAction.js +45 -0
- package/src/commons/Automate/ItemScriptActionStyles.js +42 -0
- package/src/commons/Automate/__test__/ItemAutomate.test.js +16 -0
- package/src/commons/Automate/__test__/ItemScriptAction.test.js +16 -0
- package/src/commons/BackDefault/__test__/BackDefault.test.js +21 -0
- package/src/commons/BottomScrollPicker/index.js +62 -0
- package/src/commons/BottomScrollPicker/styles.js +13 -0
- package/src/commons/BottomSheet/index.js +41 -0
- package/src/commons/BottomSheet/styles.js +37 -0
- package/src/commons/Button/index.js +6 -1
- package/src/commons/ButtonPopup/__test__/__snapshots__/ButtonPopup.test.js.snap +2 -0
- package/src/commons/ButtonPopup/index.js +2 -0
- package/src/commons/Calendar/index.js +72 -0
- package/src/commons/Calendar/styles.js +11 -0
- package/src/commons/CameraDevice/index.js +2 -1
- package/src/commons/ChartLoading/__test__/ChartLoading.test.js +9 -7
- package/src/commons/ChartLoading/index.js +2 -1
- package/src/commons/DateTimeRangeChange/index.js +2 -1
- package/src/commons/Device/ConnectedViewHeader.js +3 -1
- package/src/commons/Device/DeviceAlertStatus.js +5 -2
- package/src/commons/Device/DisconnectedView.js +34 -26
- package/src/commons/Device/Emergency/EmergencyButton.js +2 -1
- package/src/commons/Device/Emergency/EmergencyDetail.js +2 -1
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +14 -6
- package/src/commons/Device/Emergency/__test__/EmergencyDetail.test.js +10 -2
- package/src/commons/Device/FlatListItems.js +3 -2
- package/src/commons/Device/FooterInfo.js +2 -1
- package/src/commons/Device/HistoryChart.js +2 -1
- package/src/commons/Device/ItemAddNew/index.js +8 -3
- package/src/commons/Device/SensorConnectedStatus.js +2 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +19 -11
- package/src/commons/Device/WindDirection/Compass/index.js +1 -1
- package/src/commons/Device/WindSpeed/LinearChart/__test__/LinearChart.test.js +9 -3
- package/src/commons/Device/WindSpeed/LinearChart/__test__/__snapshots__/LinearChart.test.js.snap +0 -81
- package/src/commons/Device/WindSpeed/LinearChart/index.js +2 -1
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +16 -8
- package/src/commons/Device/__test__/DeviceAlertStatus.test.js +13 -5
- package/src/commons/Device/__test__/DisconnectedView.test.js +13 -5
- package/src/commons/Device/__test__/FlatListItems.test.js +9 -1
- package/src/commons/Device/__test__/FooterInfo.test.js +13 -4
- package/src/commons/Device/__test__/SensorConnectedStatus.test.js +9 -1
- package/src/commons/Device/__test__/__snapshots__/DisconnectedView.test.js.snap +20 -20
- package/src/commons/DisplayChecking/__test__/DisplayChecking.test.js +28 -0
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -1
- package/src/commons/EmergencyButton/AlertSent.js +3 -2
- package/src/commons/Explore/CityItem/index.js +2 -1
- package/src/commons/Explore/HeaderExplore/index.js +2 -1
- package/src/commons/Explore/HeaderLabel/index.js +2 -1
- package/src/commons/Explore/SearchBox/__test__/SearchBox.test.js +9 -2
- package/src/commons/Explore/SearchBox/index.js +2 -1
- package/src/commons/Explore/__test__/CityItem.test.js +13 -15
- package/src/commons/Explore/__test__/HeaderExplore.test.js +11 -7
- package/src/commons/Explore/__test__/HeaderLabel.test.js +15 -9
- package/src/commons/Explore/__test__/LocationItem.test.js +31 -0
- package/src/commons/Header/HeaderCustom.js +22 -2
- package/src/commons/Header/Styles/HeaderCustomStyles.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +12 -4
- package/src/commons/HeaderAni/index.js +36 -5
- package/src/commons/HorizontalPicker/index.js +134 -0
- package/src/commons/HorizontalPicker/styles.js +56 -0
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +19 -13
- package/src/commons/ImagePicker/index.js +3 -1
- package/src/commons/MediaPlayer/index.js +2 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +14 -8
- package/src/commons/MediaPlayerDetail/index.js +4 -1
- package/src/commons/MenuActionAddnew/__test__/MenuActionAddNew.test.js +11 -20
- package/src/commons/MenuActionAddnew/index.js +2 -1
- package/src/commons/Modal/ModalBottom.js +51 -0
- package/src/commons/Modal/ModalFullVideo.js +2 -1
- package/src/commons/Modal/Styles/ModalBottomStyles.js +35 -0
- package/src/commons/Modal/__test__/ModalBottom.test.js +39 -0
- package/src/commons/Modal/index.js +2 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/RowItem/__test__/RowItem.test.js +16 -0
- package/src/commons/RowItem/index.js +61 -0
- package/src/commons/RowItem/styles.js +53 -0
- package/src/commons/SelectActionCard/SelectActionStyles.js +16 -0
- package/src/commons/SelectActionCard/index.js +30 -0
- package/src/commons/Sharing/DevicePermissionsCheckbox.js +2 -1
- package/src/commons/Sharing/MemberList.js +3 -1
- package/src/commons/Sharing/RowMember.js +3 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -1
- package/src/commons/Sharing/WrapHeaderScrollable.js +78 -74
- package/src/commons/Sharing/__test__/DevicePermissionsCheckbox.test.js +15 -9
- package/src/commons/Sharing/__test__/MemberList.test.js +17 -25
- package/src/commons/Sharing/__test__/StationDevicePermission.test.js +17 -12
- package/src/commons/Sharing/__test__/WrapHeaderScrollable.test.js +0 -9
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +101 -0
- package/src/commons/SubUnit/OneTap/ItemOneTapStyles.js +41 -0
- package/src/commons/SubUnit/OneTap/OneTapStyles.js +36 -0
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +195 -0
- package/src/commons/SubUnit/OneTap/index.js +39 -0
- package/src/commons/SubUnit/ShortDetail.js +11 -6
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +14 -6
- package/src/commons/Today/__test__/Today.test.js +9 -1
- package/src/commons/Today/__test__/__snapshots__/Today.test.js.snap +1 -1
- package/src/commons/Today/index.js +2 -1
- package/src/commons/Unit/SharedUnit.js +2 -1
- package/src/commons/Unit/__test__/SharedUnit.test.js +330 -0
- package/src/commons/UnitSummary/AirQuality/SegmentedRoundDisplay/index.js +1 -2
- package/src/commons/UnitSummary/AirQuality/__test__/index.test.js +16 -17
- package/src/commons/UnitSummary/AirQuality/index.js +5 -120
- package/src/commons/UnitSummary/AirQuality/styles.js +112 -0
- package/src/commons/UnitSummary/TotalPowerConsumption/index.js +2 -1
- package/src/commons/UnitSummary/__test__/TotalPowerConsumption.test.js +15 -9
- package/src/commons/WheelDateTimePicker/Picker.js +57 -0
- package/src/commons/WheelDateTimePicker/index.js +168 -0
- package/src/commons/WheelDateTimePicker/styles.js +21 -0
- package/src/commons/index.js +2 -0
- package/src/configs/API.js +29 -0
- package/src/configs/Colors.js +1 -0
- package/src/configs/Constants.js +61 -0
- package/src/configs/Images.js +1 -0
- package/src/configs/SCConfig.js +7 -0
- package/src/configs/Theme.js +20 -0
- package/src/context/SCContext.tsx +9 -39
- package/src/context/actionType.ts +11 -0
- package/src/context/mockStore.ts +51 -0
- package/src/context/reducer.ts +23 -0
- package/src/hooks/Common/__test__/useStatusbar.test.js +28 -0
- package/src/hooks/Common/__test__/useTranslations.test.js +23 -0
- package/src/hooks/Common/index.js +2 -0
- package/src/hooks/Common/useGetIdUser.js +9 -0
- package/src/hooks/Common/useTranslations.ts +34 -0
- package/src/iot/Monitor.js +2 -1
- package/src/iot/RemoteControl/Bluetooth.js +2 -6
- package/src/iot/RemoteControl/GoogleHome.js +1 -1
- package/src/iot/RemoteControl/Internet.js +1 -1
- package/src/iot/RemoteControl/LG.js +57 -15
- package/src/iot/RemoteControl/__test__/Bluetooth.test.js +3 -5
- package/src/iot/RemoteControl/__test__/GoogleHome.test.js +3 -3
- package/src/iot/RemoteControl/__test__/Internet.test.js +1 -8
- package/src/iot/RemoteControl/__test__/LgThinq.test.js +7 -10
- package/src/iot/RemoteControl/index.js +1 -1
- package/src/iot/states.js +1 -0
- package/src/navigations/AutomateStack.js +45 -0
- package/src/navigations/SharedStack.js +2 -1
- package/src/navigations/UnitStack.js +86 -6
- package/src/navigations/utils.js +8 -0
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +9 -1
- package/src/screens/AQIGuide/index.js +2 -2
- package/src/screens/ActivityLog/__test__/index.test.js +14 -39
- package/src/screens/ActivityLog/index.js +2 -1
- package/src/screens/AddCommon/SelectSubUnit.js +5 -4
- package/src/screens/AddCommon/SelectUnit.js +3 -2
- package/src/screens/AddCommon/__test__/SelectSubUnit.test.js +61 -0
- package/src/screens/AddCommon/__test__/SelectUnit.test.js +18 -10
- package/src/screens/AddLocationMaps/index.js +2 -1
- package/src/screens/AddNewAction/Components/LoadingSelectAction.js +40 -0
- package/src/screens/AddNewAction/Components/index.js +3 -0
- package/src/screens/AddNewAction/Device/DeviceStyles.js +43 -0
- package/src/screens/AddNewAction/Device/__test__/index.test.js +42 -0
- package/src/screens/AddNewAction/Device/index.js +33 -0
- package/src/screens/AddNewAction/SelectAction.js +237 -0
- package/src/screens/AddNewAction/SelectSensorDevices.js +150 -0
- package/src/screens/AddNewAction/SetupSensor.js +221 -0
- package/src/screens/AddNewAction/Styles/SelectActionStyles.js +62 -0
- package/src/screens/AddNewAction/Styles/SelectSensorDevicesStyles.js +36 -0
- package/src/screens/AddNewAction/Styles/SetupSensorStyles.js +76 -0
- package/src/screens/AddNewAction/__test__/SelectAction.test.js +153 -0
- package/src/screens/AddNewAction/__test__/SelectSensorDevices.test.js +191 -0
- package/src/screens/AddNewAction/__test__/SetupSensor.test.js +125 -0
- package/src/screens/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +112 -0
- package/src/screens/AddNewAutoSmart/index.js +113 -0
- package/src/screens/AddNewAutoSmart/styles/AddNewAutoSmartStyles.js +36 -0
- package/src/screens/AddNewDevice/ConnectDevices.js +2 -1
- package/src/screens/AddNewDevice/ConnectingDevices.js +2 -1
- package/src/screens/AddNewDevice/__test__/AddNewDevice.test.js +29 -13
- package/src/screens/AddNewDevice/__test__/ConnectDevices.test.js +19 -7
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +16 -6
- package/src/screens/AddNewDevice/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewDevice/index.js +2 -1
- package/src/screens/AddNewGateway/ConnectedGateway.js +2 -1
- package/src/screens/AddNewGateway/ConnectingGateway.js +99 -24
- package/src/screens/AddNewGateway/ConnectingGatewayStyles.js +92 -0
- package/src/screens/AddNewGateway/SetupGatewayWifi.js +3 -2
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +35 -72
- package/src/screens/AddNewGateway/__test__/ConnectedGateway.test.js +14 -4
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +20 -10
- package/src/screens/AddNewGateway/hooks/useStateAlertRename.js +2 -1
- package/src/screens/AddNewGateway/index.js +2 -1
- package/src/screens/AddNewOneTap/AddNewOneTapStyles.js +44 -0
- package/src/screens/AddNewOneTap/__test__/AddNewOneTap.test.js +130 -0
- package/src/screens/AddNewOneTap/index.js +83 -0
- package/src/screens/AllCamera/__test__/index.test.js +103 -0
- package/src/screens/AllCamera/index.js +2 -1
- package/src/screens/Automate/Components/Loading.js +64 -0
- package/src/screens/Automate/Styles/indexStyles.js +64 -0
- package/src/screens/Automate/__test__/Loading.test.js +16 -0
- package/src/screens/Automate/__test__/index.test.js +93 -0
- package/src/screens/Automate/index.js +148 -0
- package/src/screens/Device/HeaderDevice/styles.js +2 -2
- package/src/screens/Device/__test__/detail.test.js +90 -18
- package/src/screens/Device/detail.js +73 -35
- package/src/screens/Device/hooks/useCountUp.js +4 -0
- package/src/screens/Device/hooks/useEmergencyButton.js +3 -2
- package/src/screens/Device/styles.js +5 -1
- package/src/screens/DeviceInfo/__test__/index.test.js +12 -3
- package/src/screens/DeviceInfo/index.js +2 -1
- package/src/screens/EditActionsList/Styles/indexStyles.js +84 -0
- package/src/screens/EditActionsList/index.js +186 -0
- package/src/screens/EmergencyContacts/EmergencyContactsAddNew.js +3 -2
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +9 -2
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +2 -1
- package/src/screens/EmergencyContacts/__test__/EmergencyContactAddNew.test.js +15 -18
- package/src/screens/EmergencyContacts/__test__/EmergencyContactList.test.js +19 -23
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +10 -25
- package/src/screens/EmergencyContacts/hook.js +3 -2
- package/src/screens/Explore/index.js +3 -2
- package/src/screens/GuestInfo/__test__/index.test.js +176 -0
- package/src/screens/GuestInfo/components/AccessScheduleItem.js +32 -0
- package/src/screens/GuestInfo/components/AccessScheduleSheet.js +204 -0
- package/src/screens/GuestInfo/components/HeaderGuestInfo.js +36 -0
- package/src/screens/GuestInfo/components/RecurringDetail.js +106 -0
- package/src/screens/GuestInfo/components/RowGuestInfo.js +31 -0
- package/src/screens/GuestInfo/components/TemporaryDetail.js +53 -0
- package/src/screens/GuestInfo/constant.js +59 -0
- package/src/screens/GuestInfo/index.js +150 -0
- package/src/screens/GuestInfo/styles/AccessScheduleDetailStyles.js +31 -0
- package/src/screens/GuestInfo/styles/AccessScheduleItemStyles.js +22 -0
- package/src/screens/GuestInfo/styles/HeaderGuestInfoStyles.js +31 -0
- package/src/screens/GuestInfo/styles/indexStyles.js +38 -0
- package/src/screens/ManageAccess/__test__/ManageAccess.test.js +13 -1
- package/src/screens/ManageAccess/hooks/index.js +4 -0
- package/src/screens/ManageAccess/index.js +49 -20
- package/src/screens/ManageAccess/styles/ManageAccessStyles.js +3 -0
- package/src/screens/PlayBackCamera/Timer.js +1 -1
- package/src/screens/PlayBackCamera/index.js +9 -5
- package/src/screens/ScanChipQR/__test__/ScanChipQR.test.js +2 -11
- package/src/screens/ScanChipQR/components/QRScan/index.js +2 -1
- package/src/screens/ScriptDetail/Styles/indexStyles.js +157 -0
- package/src/screens/ScriptDetail/__test__/index.test.js +119 -0
- package/src/screens/ScriptDetail/hooks/index.js +55 -0
- package/src/screens/ScriptDetail/index.js +344 -0
- package/src/screens/SelectUnit/Styles/indexStyles.js +55 -0
- package/src/screens/SelectUnit/__test__/index.test.js +85 -0
- package/src/screens/SelectUnit/index.js +100 -0
- package/src/screens/SetSchedule/__test__/index.test.js +97 -0
- package/src/screens/SetSchedule/components/RepeatOptionsPopup.js +56 -0
- package/src/screens/SetSchedule/components/RowItem.js +27 -0
- package/src/screens/SetSchedule/components/SelectWeekday.js +65 -0
- package/src/screens/SetSchedule/index.js +139 -0
- package/src/screens/SetSchedule/styles/RepeatOptionsPopupStyles.js +22 -0
- package/src/screens/SetSchedule/styles/RowItemStyles.js +29 -0
- package/src/screens/SetSchedule/styles/SelectWeekdayStyles.js +26 -0
- package/src/screens/SetSchedule/styles/indexStyles.js +22 -0
- package/src/screens/SharedUnit/TabHeader.js +2 -1
- package/src/screens/SharedUnit/__test__/TabHeader.test.js +40 -0
- package/src/screens/SharedUnit/index.js +3 -2
- package/src/screens/Sharing/MemberList.js +2 -1
- package/src/screens/Sharing/SelectPermission.js +2 -1
- package/src/screens/Sharing/SelectUser.js +3 -2
- package/src/screens/Sharing/__test__/MemberList.test.js +25 -28
- package/src/screens/Sharing/__test__/SelectPermission.test.js +16 -8
- package/src/screens/Sharing/__test__/SelectUser.test.js +33 -15
- package/src/screens/Sharing/hooks/index.js +22 -17
- package/src/screens/SubUnit/AddSubUnit.js +3 -2
- package/src/screens/SubUnit/Detail.js +5 -4
- package/src/screens/SubUnit/EditSubUnit.js +274 -0
- package/src/screens/SubUnit/EditSubUnitStyles.js +119 -0
- package/src/screens/SubUnit/ManageSubUnit.js +114 -371
- package/src/screens/SubUnit/ManageSubUnitStyles.js +40 -0
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +17 -11
- package/src/screens/SubUnit/__test__/Detail.test.js +11 -31
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +427 -0
- package/src/screens/SubUnit/__test__/ManageSubUnit.test.js +51 -384
- package/src/screens/SubUnit/hooks/__test__/useManageSubUnit.test.js +85 -0
- package/src/screens/SubUnit/hooks/useManageSubUnit.js +35 -0
- package/src/screens/SyncLGDevice/AddLGDevice.js +3 -2
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +9 -1
- package/src/screens/TDSGuide/index.js +2 -1
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +9 -1
- package/src/screens/UVIndexGuide/index.js +2 -1
- package/src/screens/Unit/AddMenu.js +3 -2
- package/src/screens/Unit/Detail.js +66 -20
- package/src/screens/Unit/ManageUnit/index.js +4 -3
- package/src/screens/Unit/ManageUnit.js +15 -4
- package/src/screens/Unit/MoreMenu.js +3 -2
- package/src/screens/Unit/SelectLocation.js +8 -2
- package/src/screens/Unit/SelectLocationStyles.js +11 -0
- package/src/screens/Unit/__test__/AddMenu.test.js +15 -15
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +19 -10
- package/src/screens/Unit/__test__/Detail.test.js +92 -33
- package/src/screens/Unit/__test__/ManageUnit.test.js +16 -23
- package/src/screens/Unit/components/Header/index.js +2 -1
- package/src/screens/Unit/components/ListMyAllUnit/index.js +2 -1
- package/src/screens/Unit/components/MyUnit/index.js +2 -1
- package/src/screens/Unit/components/SearchLocation/__test__/RowLocation.test.js +36 -0
- package/src/screens/Unit/components/SearchLocation/index.js +2 -1
- package/src/screens/Unit/components/SharedUnit/index.js +2 -1
- package/src/screens/Unit/components/__test__/MyUnit.test.js +22 -72
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +32 -0
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +11 -2
- package/src/screens/UnitSummary/__test__/index.test.js +12 -4
- package/src/screens/UnitSummary/components/3PPowerConsumption/__test__/3PPowerConsumption.test.js +13 -3
- package/src/screens/UnitSummary/components/3PPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/PowerConsumption/__test__/PowerConsumption.test.js +16 -12
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/RunningDevices/__test__/index.test.js +2 -2
- package/src/screens/UnitSummary/components/Temperature/index.js +2 -1
- package/src/screens/UnitSummary/components/TotalPowerConsumption/index.js +2 -1
- package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap +37 -37
- package/src/screens/UnitSummary/components/UvIndex/__test__/index.test.js +14 -6
- package/src/screens/UnitSummary/components/UvIndex/index.js +2 -1
- package/src/screens/UnitSummary/components/WaterQuality/__test__/index.test.js +11 -5
- package/src/screens/UnitSummary/components/WaterQuality/index.js +2 -1
- package/src/screens/UnitSummary/components/__test__/TotalPowerConsumption.test.js +13 -7
- package/src/screens/UnitSummary/components/__test__/UnitSummary.test.js +67 -0
- package/src/screens/UnitSummary/components/__test__/index.test.js +48 -0
- package/src/screens/UnitSummary/components/index.js +1 -37
- package/src/screens/UnitSummary/components/indexstyles.js +39 -0
- package/src/screens/UnitSummary/index.js +2 -1
- package/src/screens/WaterQualityGuide/__test__/index.test.js +12 -12
- package/src/screens/WaterQualityGuide/index.js +2 -1
- package/src/utils/Apis/axios.js +0 -4
- package/src/utils/Converter/array.js +4 -0
- package/src/utils/Converter/time.js +29 -4
- package/src/utils/I18n/index.ts +6 -0
- package/src/utils/I18n/translations/en.json +77 -5
- package/src/utils/I18n/translations/vi.json +73 -3
- package/src/utils/I18n/translations.ts +45 -0
- package/src/utils/Route/index.js +13 -0
- package/src/utils/__test__/InitData.test.js +20 -0
- package/src/commons/ChartLoading/__test__/__snapshots__/ChartLoading.test.js.snap +0 -66
- package/src/commons/Device/HistoryChart/__test__/HistoryChart.test.js +0 -57
- package/src/commons/Device/HistoryChart/__test__/__snapshots__/HistoryChart.test.js.snap +0 -593
- package/src/commons/Explore/SearchBox/__test__/__snapshots__/SearchBox.test.js.snap +0 -59
- package/src/commons/Header/__test__/Header.test.js +0 -24
- package/src/commons/MenuActionAddnew/__test__/__snapshots__/MenuActionAddNew.test.js.snap +0 -788
- package/src/commons/Sharing/__test__/__snapshots__/WrapHeaderScrollable.test.js.snap +0 -174
- package/src/commons/UnitSummary/AirQuality/__test__/__snapshots__/index.test.js.snap +0 -26679
- package/src/iot/RemoteControl/__test__/index.test.js +0 -101
- package/src/iot/__test__/Monitor.test.js +0 -119
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactAddNew.test.js.snap +0 -1706
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactList.test.js.snap +0 -4276
- package/src/screens/EmergencyContacts/__test__/__snapshots__/EmergencyContactsSelectContacts.test.js.snap +0 -2240
- package/src/screens/SyncLGDevice/__test__/AddLGDevice.test.js +0 -358
- package/src/screens/Unit/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/Unit/components/MyAllUnit/__test__/__snapshots__/index.test.js.snap +0 -1001
- package/src/screens/Unit/components/MyAllUnit/__test__/index.test.js +0 -48
- package/src/screens/UnitSummary/components/WaterQuality/__test__/__snapshots__/index.test.js.snap +0 -1574
- package/src/screens/WaterQualityGuide/__test__/__snapshots__/index.test.js.snap +0 -3375
- package/src/utils/Converter/__test__/time.test.js +0 -126
- package/src/utils/I18n/index.js +0 -19
- package/src/utils/I18n/index.test.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
4
4
|
|
|
5
5
|
import { Colors } from '../../../../configs';
|
|
6
6
|
import Text from '../../../../commons/Text';
|
|
@@ -8,6 +8,7 @@ import TotalPowerBox from '../TotalPowerBox';
|
|
|
8
8
|
import { TESTID } from '../../../../configs/Constants';
|
|
9
9
|
|
|
10
10
|
const TotalPowerConsumption = memo(({ time, total }) => {
|
|
11
|
+
const t = useTranslations();
|
|
11
12
|
return (
|
|
12
13
|
<View style={styles.container}>
|
|
13
14
|
<Text color={Colors.Gray9} size={16} style={styles.txtCurrent}>
|
package/src/screens/UnitSummary/components/UvIndex/__test__/__snapshots__/index.test.js.snap
CHANGED
|
@@ -38,7 +38,7 @@ Array [
|
|
|
38
38
|
]
|
|
39
39
|
}
|
|
40
40
|
>
|
|
41
|
-
|
|
41
|
+
Today, Jan 24
|
|
42
42
|
</Text>
|
|
43
43
|
</View>
|
|
44
44
|
<View>
|
|
@@ -2687,7 +2687,7 @@ Array [
|
|
|
2687
2687
|
}
|
|
2688
2688
|
>
|
|
2689
2689
|
<RNSVGTSpan
|
|
2690
|
-
content="
|
|
2690
|
+
content="UV Index "
|
|
2691
2691
|
dx={Array []}
|
|
2692
2692
|
dy={Array []}
|
|
2693
2693
|
font={Object {}}
|
|
@@ -2804,7 +2804,7 @@ Array [
|
|
|
2804
2804
|
]
|
|
2805
2805
|
}
|
|
2806
2806
|
>
|
|
2807
|
-
|
|
2807
|
+
Protection advices:
|
|
2808
2808
|
</Text>
|
|
2809
2809
|
</View>
|
|
2810
2810
|
</View>,
|
|
@@ -2848,7 +2848,7 @@ Array [
|
|
|
2848
2848
|
]
|
|
2849
2849
|
}
|
|
2850
2850
|
>
|
|
2851
|
-
|
|
2851
|
+
History
|
|
2852
2852
|
</Text>
|
|
2853
2853
|
<View
|
|
2854
2854
|
style={
|
|
@@ -2878,7 +2878,7 @@ Array [
|
|
|
2878
2878
|
]
|
|
2879
2879
|
}
|
|
2880
2880
|
>
|
|
2881
|
-
|
|
2881
|
+
From
|
|
2882
2882
|
</Text>
|
|
2883
2883
|
<View
|
|
2884
2884
|
accessible={true}
|
|
@@ -2958,7 +2958,7 @@ Array [
|
|
|
2958
2958
|
]
|
|
2959
2959
|
}
|
|
2960
2960
|
>
|
|
2961
|
-
|
|
2961
|
+
to
|
|
2962
2962
|
</Text>
|
|
2963
2963
|
<View
|
|
2964
2964
|
accessible={true}
|
|
@@ -3168,7 +3168,7 @@ Array [
|
|
|
3168
3168
|
]
|
|
3169
3169
|
}
|
|
3170
3170
|
>
|
|
3171
|
-
|
|
3171
|
+
Today, Jan 24
|
|
3172
3172
|
</Text>
|
|
3173
3173
|
</View>
|
|
3174
3174
|
<View>
|
|
@@ -5817,7 +5817,7 @@ Array [
|
|
|
5817
5817
|
}
|
|
5818
5818
|
>
|
|
5819
5819
|
<RNSVGTSpan
|
|
5820
|
-
content="
|
|
5820
|
+
content="UV Index "
|
|
5821
5821
|
dx={Array []}
|
|
5822
5822
|
dy={Array []}
|
|
5823
5823
|
font={Object {}}
|
|
@@ -5934,7 +5934,7 @@ Array [
|
|
|
5934
5934
|
]
|
|
5935
5935
|
}
|
|
5936
5936
|
>
|
|
5937
|
-
|
|
5937
|
+
Protection advices:
|
|
5938
5938
|
</Text>
|
|
5939
5939
|
</View>
|
|
5940
5940
|
<View
|
|
@@ -6022,7 +6022,7 @@ Array [
|
|
|
6022
6022
|
]
|
|
6023
6023
|
}
|
|
6024
6024
|
>
|
|
6025
|
-
|
|
6025
|
+
History
|
|
6026
6026
|
</Text>
|
|
6027
6027
|
<View
|
|
6028
6028
|
style={
|
|
@@ -6052,7 +6052,7 @@ Array [
|
|
|
6052
6052
|
]
|
|
6053
6053
|
}
|
|
6054
6054
|
>
|
|
6055
|
-
|
|
6055
|
+
From
|
|
6056
6056
|
</Text>
|
|
6057
6057
|
<View
|
|
6058
6058
|
accessible={true}
|
|
@@ -6132,7 +6132,7 @@ Array [
|
|
|
6132
6132
|
]
|
|
6133
6133
|
}
|
|
6134
6134
|
>
|
|
6135
|
-
|
|
6135
|
+
to
|
|
6136
6136
|
</Text>
|
|
6137
6137
|
<View
|
|
6138
6138
|
accessible={true}
|
|
@@ -6342,7 +6342,7 @@ Array [
|
|
|
6342
6342
|
]
|
|
6343
6343
|
}
|
|
6344
6344
|
>
|
|
6345
|
-
|
|
6345
|
+
Today, Jan 24
|
|
6346
6346
|
</Text>
|
|
6347
6347
|
</View>
|
|
6348
6348
|
<View>
|
|
@@ -8991,7 +8991,7 @@ Array [
|
|
|
8991
8991
|
}
|
|
8992
8992
|
>
|
|
8993
8993
|
<RNSVGTSpan
|
|
8994
|
-
content="
|
|
8994
|
+
content="UV Index "
|
|
8995
8995
|
dx={Array []}
|
|
8996
8996
|
dy={Array []}
|
|
8997
8997
|
font={Object {}}
|
|
@@ -9108,7 +9108,7 @@ Array [
|
|
|
9108
9108
|
]
|
|
9109
9109
|
}
|
|
9110
9110
|
>
|
|
9111
|
-
|
|
9111
|
+
Protection advices:
|
|
9112
9112
|
</Text>
|
|
9113
9113
|
</View>
|
|
9114
9114
|
</View>,
|
|
@@ -9152,7 +9152,7 @@ Array [
|
|
|
9152
9152
|
]
|
|
9153
9153
|
}
|
|
9154
9154
|
>
|
|
9155
|
-
|
|
9155
|
+
History
|
|
9156
9156
|
</Text>
|
|
9157
9157
|
<View
|
|
9158
9158
|
style={
|
|
@@ -9182,7 +9182,7 @@ Array [
|
|
|
9182
9182
|
]
|
|
9183
9183
|
}
|
|
9184
9184
|
>
|
|
9185
|
-
|
|
9185
|
+
From
|
|
9186
9186
|
</Text>
|
|
9187
9187
|
<View
|
|
9188
9188
|
accessible={true}
|
|
@@ -9262,7 +9262,7 @@ Array [
|
|
|
9262
9262
|
]
|
|
9263
9263
|
}
|
|
9264
9264
|
>
|
|
9265
|
-
|
|
9265
|
+
to
|
|
9266
9266
|
</Text>
|
|
9267
9267
|
<View
|
|
9268
9268
|
accessible={true}
|
|
@@ -9472,7 +9472,7 @@ Array [
|
|
|
9472
9472
|
]
|
|
9473
9473
|
}
|
|
9474
9474
|
>
|
|
9475
|
-
|
|
9475
|
+
Today, Jan 24
|
|
9476
9476
|
</Text>
|
|
9477
9477
|
</View>
|
|
9478
9478
|
<View>
|
|
@@ -12121,7 +12121,7 @@ Array [
|
|
|
12121
12121
|
}
|
|
12122
12122
|
>
|
|
12123
12123
|
<RNSVGTSpan
|
|
12124
|
-
content="
|
|
12124
|
+
content="UV Index "
|
|
12125
12125
|
dx={Array []}
|
|
12126
12126
|
dy={Array []}
|
|
12127
12127
|
font={Object {}}
|
|
@@ -12215,7 +12215,7 @@ Array [
|
|
|
12215
12215
|
]
|
|
12216
12216
|
}
|
|
12217
12217
|
>
|
|
12218
|
-
|
|
12218
|
+
Protection advices:
|
|
12219
12219
|
</Text>
|
|
12220
12220
|
</View>
|
|
12221
12221
|
</View>,
|
|
@@ -12259,7 +12259,7 @@ Array [
|
|
|
12259
12259
|
]
|
|
12260
12260
|
}
|
|
12261
12261
|
>
|
|
12262
|
-
|
|
12262
|
+
History
|
|
12263
12263
|
</Text>
|
|
12264
12264
|
<View
|
|
12265
12265
|
style={
|
|
@@ -12289,7 +12289,7 @@ Array [
|
|
|
12289
12289
|
]
|
|
12290
12290
|
}
|
|
12291
12291
|
>
|
|
12292
|
-
|
|
12292
|
+
From
|
|
12293
12293
|
</Text>
|
|
12294
12294
|
<View
|
|
12295
12295
|
accessible={true}
|
|
@@ -12369,7 +12369,7 @@ Array [
|
|
|
12369
12369
|
]
|
|
12370
12370
|
}
|
|
12371
12371
|
>
|
|
12372
|
-
|
|
12372
|
+
to
|
|
12373
12373
|
</Text>
|
|
12374
12374
|
<View
|
|
12375
12375
|
accessible={true}
|
|
@@ -12579,7 +12579,7 @@ Array [
|
|
|
12579
12579
|
]
|
|
12580
12580
|
}
|
|
12581
12581
|
>
|
|
12582
|
-
|
|
12582
|
+
Today, Jan 24
|
|
12583
12583
|
</Text>
|
|
12584
12584
|
</View>
|
|
12585
12585
|
<View>
|
|
@@ -15228,7 +15228,7 @@ Array [
|
|
|
15228
15228
|
}
|
|
15229
15229
|
>
|
|
15230
15230
|
<RNSVGTSpan
|
|
15231
|
-
content="
|
|
15231
|
+
content="UV Index "
|
|
15232
15232
|
dx={Array []}
|
|
15233
15233
|
dy={Array []}
|
|
15234
15234
|
font={Object {}}
|
|
@@ -15267,7 +15267,7 @@ Array [
|
|
|
15267
15267
|
}
|
|
15268
15268
|
>
|
|
15269
15269
|
<RNSVGTSpan
|
|
15270
|
-
content="
|
|
15270
|
+
content="Loading"
|
|
15271
15271
|
dx={Array []}
|
|
15272
15272
|
dy={Array []}
|
|
15273
15273
|
font={Object {}}
|
|
@@ -15322,7 +15322,7 @@ Array [
|
|
|
15322
15322
|
]
|
|
15323
15323
|
}
|
|
15324
15324
|
>
|
|
15325
|
-
|
|
15325
|
+
Protection advices:
|
|
15326
15326
|
</Text>
|
|
15327
15327
|
</View>
|
|
15328
15328
|
</View>,
|
|
@@ -15366,7 +15366,7 @@ Array [
|
|
|
15366
15366
|
]
|
|
15367
15367
|
}
|
|
15368
15368
|
>
|
|
15369
|
-
|
|
15369
|
+
History
|
|
15370
15370
|
</Text>
|
|
15371
15371
|
<View
|
|
15372
15372
|
style={
|
|
@@ -15396,7 +15396,7 @@ Array [
|
|
|
15396
15396
|
]
|
|
15397
15397
|
}
|
|
15398
15398
|
>
|
|
15399
|
-
|
|
15399
|
+
From
|
|
15400
15400
|
</Text>
|
|
15401
15401
|
<View
|
|
15402
15402
|
accessible={true}
|
|
@@ -15476,7 +15476,7 @@ Array [
|
|
|
15476
15476
|
]
|
|
15477
15477
|
}
|
|
15478
15478
|
>
|
|
15479
|
-
|
|
15479
|
+
to
|
|
15480
15480
|
</Text>
|
|
15481
15481
|
<View
|
|
15482
15482
|
accessible={true}
|
|
@@ -15686,7 +15686,7 @@ Array [
|
|
|
15686
15686
|
]
|
|
15687
15687
|
}
|
|
15688
15688
|
>
|
|
15689
|
-
|
|
15689
|
+
Today, Jan 24
|
|
15690
15690
|
</Text>
|
|
15691
15691
|
</View>
|
|
15692
15692
|
<View>
|
|
@@ -18335,7 +18335,7 @@ Array [
|
|
|
18335
18335
|
}
|
|
18336
18336
|
>
|
|
18337
18337
|
<RNSVGTSpan
|
|
18338
|
-
content="
|
|
18338
|
+
content="UV Index "
|
|
18339
18339
|
dx={Array []}
|
|
18340
18340
|
dy={Array []}
|
|
18341
18341
|
font={Object {}}
|
|
@@ -18452,7 +18452,7 @@ Array [
|
|
|
18452
18452
|
]
|
|
18453
18453
|
}
|
|
18454
18454
|
>
|
|
18455
|
-
|
|
18455
|
+
Protection advices:
|
|
18456
18456
|
</Text>
|
|
18457
18457
|
</View>
|
|
18458
18458
|
</View>,
|
|
@@ -18496,7 +18496,7 @@ Array [
|
|
|
18496
18496
|
]
|
|
18497
18497
|
}
|
|
18498
18498
|
>
|
|
18499
|
-
|
|
18499
|
+
History
|
|
18500
18500
|
</Text>
|
|
18501
18501
|
<View
|
|
18502
18502
|
style={
|
|
@@ -18526,7 +18526,7 @@ Array [
|
|
|
18526
18526
|
]
|
|
18527
18527
|
}
|
|
18528
18528
|
>
|
|
18529
|
-
|
|
18529
|
+
From
|
|
18530
18530
|
</Text>
|
|
18531
18531
|
<View
|
|
18532
18532
|
accessible={true}
|
|
@@ -18606,7 +18606,7 @@ Array [
|
|
|
18606
18606
|
]
|
|
18607
18607
|
}
|
|
18608
18608
|
>
|
|
18609
|
-
|
|
18609
|
+
to
|
|
18610
18610
|
</Text>
|
|
18611
18611
|
<View
|
|
18612
18612
|
accessible={true}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { create, act } from 'react-test-renderer';
|
|
3
|
+
import { SCProvider } from '../../../../../context';
|
|
4
|
+
import { mockSCStore } from '../../../../../context/mockStore';
|
|
3
5
|
import UvIndex from '../index';
|
|
4
6
|
|
|
7
|
+
const wrapComponent = (data) => (
|
|
8
|
+
<SCProvider initState={mockSCStore({})}>
|
|
9
|
+
<UvIndex {...data} />
|
|
10
|
+
</SCProvider>
|
|
11
|
+
);
|
|
12
|
+
|
|
5
13
|
describe('Test UvIndex', () => {
|
|
6
14
|
let data;
|
|
7
15
|
|
|
@@ -21,7 +29,7 @@ describe('Test UvIndex', () => {
|
|
|
21
29
|
|
|
22
30
|
test('render UvIndex', async () => {
|
|
23
31
|
act(() => {
|
|
24
|
-
tree = create(
|
|
32
|
+
tree = create(wrapComponent(data));
|
|
25
33
|
});
|
|
26
34
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
27
35
|
});
|
|
@@ -29,7 +37,7 @@ describe('Test UvIndex', () => {
|
|
|
29
37
|
test('render UvIndex with negative uv_value', async () => {
|
|
30
38
|
data.summaryDetail.uv_value = -1;
|
|
31
39
|
act(() => {
|
|
32
|
-
tree = create(
|
|
40
|
+
tree = create(wrapComponent(data));
|
|
33
41
|
});
|
|
34
42
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
35
43
|
});
|
|
@@ -37,7 +45,7 @@ describe('Test UvIndex', () => {
|
|
|
37
45
|
test('render UvIndex with high uv_value', async () => {
|
|
38
46
|
data.summaryDetail.uv_value = 11;
|
|
39
47
|
act(() => {
|
|
40
|
-
tree = create(
|
|
48
|
+
tree = create(wrapComponent(data));
|
|
41
49
|
});
|
|
42
50
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
43
51
|
});
|
|
@@ -45,7 +53,7 @@ describe('Test UvIndex', () => {
|
|
|
45
53
|
test('render UvIndex with advices', async () => {
|
|
46
54
|
data.summaryDetail.advices = ['Amazing good chop'];
|
|
47
55
|
act(() => {
|
|
48
|
-
tree = create(
|
|
56
|
+
tree = create(wrapComponent(data));
|
|
49
57
|
});
|
|
50
58
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
51
59
|
});
|
|
@@ -53,7 +61,7 @@ describe('Test UvIndex', () => {
|
|
|
53
61
|
test('render UvIndex without advices', async () => {
|
|
54
62
|
delete data.summaryDetail.advices;
|
|
55
63
|
act(() => {
|
|
56
|
-
tree = create(
|
|
64
|
+
tree = create(wrapComponent(data));
|
|
57
65
|
});
|
|
58
66
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
59
67
|
});
|
|
@@ -61,7 +69,7 @@ describe('Test UvIndex', () => {
|
|
|
61
69
|
test('render UvIndex with undefined uv_value', async () => {
|
|
62
70
|
data.summaryDetail.uv_value = undefined;
|
|
63
71
|
act(() => {
|
|
64
|
-
tree = create(
|
|
72
|
+
tree = create(wrapComponent(data));
|
|
65
73
|
});
|
|
66
74
|
expect(tree.toJSON()).toMatchSnapshot();
|
|
67
75
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
|
-
import {
|
|
4
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
5
5
|
|
|
6
6
|
import { Colors } from '../../../../configs';
|
|
7
7
|
import Text from '../../../../commons/Text';
|
|
@@ -10,6 +10,7 @@ import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryCha
|
|
|
10
10
|
import SegmentedRoundDisplay from '../../../../commons/UnitSummary/AirQuality/SegmentedRoundDisplay';
|
|
11
11
|
|
|
12
12
|
const UvIndex = memo(({ summaryDetail }) => {
|
|
13
|
+
const t = useTranslations();
|
|
13
14
|
const { uv_id } = summaryDetail;
|
|
14
15
|
const showBoxHistory = useMemo(() => {
|
|
15
16
|
return !!uv_id;
|
|
@@ -4,6 +4,8 @@ import { act, create } from 'react-test-renderer';
|
|
|
4
4
|
import Routes from '../../../../../utils/Route';
|
|
5
5
|
import WaterQuality from '../index';
|
|
6
6
|
import { Section } from '../../../../../commons';
|
|
7
|
+
import { SCProvider } from '../../../../../context';
|
|
8
|
+
import { mockSCStore } from '../../../../../context/mockStore';
|
|
7
9
|
|
|
8
10
|
const mockedNavigate = jest.fn();
|
|
9
11
|
|
|
@@ -16,6 +18,12 @@ jest.mock('@react-navigation/native', () => {
|
|
|
16
18
|
};
|
|
17
19
|
});
|
|
18
20
|
|
|
21
|
+
const wrapComponent = (data) => (
|
|
22
|
+
<SCProvider initState={mockSCStore({})}>
|
|
23
|
+
<WaterQuality {...data} />
|
|
24
|
+
</SCProvider>
|
|
25
|
+
);
|
|
26
|
+
|
|
19
27
|
describe('Test WaterQualityGuide', () => {
|
|
20
28
|
let data;
|
|
21
29
|
|
|
@@ -36,9 +44,8 @@ describe('Test WaterQualityGuide', () => {
|
|
|
36
44
|
|
|
37
45
|
test('render WaterQualityGuide', async () => {
|
|
38
46
|
act(() => {
|
|
39
|
-
tree = create(
|
|
47
|
+
tree = create(wrapComponent(data));
|
|
40
48
|
});
|
|
41
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
42
49
|
const instance = tree.root;
|
|
43
50
|
const sections = instance.findAllByType(Section);
|
|
44
51
|
expect(sections).toHaveLength(2);
|
|
@@ -49,9 +56,8 @@ describe('Test WaterQualityGuide', () => {
|
|
|
49
56
|
data.summaryDetail.tur_id = 0;
|
|
50
57
|
data.summaryDetail.clo_id = 0;
|
|
51
58
|
act(() => {
|
|
52
|
-
tree = create(
|
|
59
|
+
tree = create(wrapComponent(data));
|
|
53
60
|
});
|
|
54
|
-
expect(tree.toJSON()).toMatchSnapshot();
|
|
55
61
|
const instance = tree.root;
|
|
56
62
|
const sections = instance.findAllByType(Section);
|
|
57
63
|
expect(sections).toHaveLength(1);
|
|
@@ -59,7 +65,7 @@ describe('Test WaterQualityGuide', () => {
|
|
|
59
65
|
|
|
60
66
|
test('onClickItem waterType', async () => {
|
|
61
67
|
act(() => {
|
|
62
|
-
tree = create(
|
|
68
|
+
tree = create(wrapComponent(data));
|
|
63
69
|
});
|
|
64
70
|
const instance = tree.root;
|
|
65
71
|
const buttons = instance.findAllByType(TouchableOpacity);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
4
4
|
import { Today, Section } from '../../../../commons';
|
|
5
5
|
import Text from '../../../../commons/Text';
|
|
6
6
|
import ConfigHistoryChart from '../../../../commons/UnitSummary/ConfigHistoryChart';
|
|
7
7
|
import Item from './Item';
|
|
8
8
|
|
|
9
9
|
const WaterQuality = memo(({ summaryDetail }) => {
|
|
10
|
+
const t = useTranslations();
|
|
10
11
|
const { ph_id, tur_id, clo_id } = summaryDetail;
|
|
11
12
|
const showBoxHistory = useMemo(() => {
|
|
12
13
|
return ph_id || tur_id || clo_id ? true : false;
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import renderer, { act } from 'react-test-renderer';
|
|
3
3
|
import { TESTID } from '../../../../configs/Constants';
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
4
6
|
import TotalPowerConsumption from '../TotalPowerConsumption/index';
|
|
5
7
|
|
|
8
|
+
const wrapComponent = () => (
|
|
9
|
+
<SCProvider initState={mockSCStore({})}>
|
|
10
|
+
<TotalPowerConsumption
|
|
11
|
+
total={{
|
|
12
|
+
value: 10,
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
</SCProvider>
|
|
16
|
+
);
|
|
17
|
+
|
|
6
18
|
describe('Test Total Power Consumption', () => {
|
|
7
19
|
let tree;
|
|
8
20
|
|
|
9
21
|
test('render Total Power Consumption', () => {
|
|
10
22
|
act(() => {
|
|
11
|
-
tree = renderer.create(
|
|
12
|
-
<TotalPowerConsumption
|
|
13
|
-
total={{
|
|
14
|
-
value: 10,
|
|
15
|
-
}}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
23
|
+
tree = renderer.create(wrapComponent());
|
|
18
24
|
});
|
|
19
25
|
const instance = tree.root;
|
|
20
26
|
const item = instance.find(
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TouchableOpacity } from 'react-native';
|
|
3
|
+
import { create } from 'react-test-renderer';
|
|
4
|
+
import { act } from 'react-test-renderer';
|
|
5
|
+
import UnitSummary from '../';
|
|
6
|
+
import styles from '../indexstyles';
|
|
7
|
+
|
|
8
|
+
const mockGoToSummary = jest.fn();
|
|
9
|
+
|
|
10
|
+
describe('Test UnitSummary', () => {
|
|
11
|
+
let tree;
|
|
12
|
+
const defaultProps = {
|
|
13
|
+
summary: {
|
|
14
|
+
color_right_text: null,
|
|
15
|
+
color_left_text: null,
|
|
16
|
+
},
|
|
17
|
+
mockGoToSummary: mockGoToSummary,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
it('Test index = 0', async () => {
|
|
21
|
+
await act(() => {
|
|
22
|
+
tree = create(<UnitSummary {...defaultProps} index={0} />);
|
|
23
|
+
});
|
|
24
|
+
const instance = tree.root;
|
|
25
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
26
|
+
expect(TouchableOpacities[0].props.style).toEqual([
|
|
27
|
+
styles.summaryContainer,
|
|
28
|
+
{ borderTopLeftRadius: 10 },
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('Test index = 1', async () => {
|
|
33
|
+
await act(() => {
|
|
34
|
+
tree = create(<UnitSummary {...defaultProps} index={1} />);
|
|
35
|
+
});
|
|
36
|
+
const instance = tree.root;
|
|
37
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
38
|
+
expect(TouchableOpacities[0].props.style).toEqual([
|
|
39
|
+
styles.summaryContainer,
|
|
40
|
+
{ borderTopRightRadius: 10 },
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('Test len % 2 === 0 && index = len - 1', async () => {
|
|
45
|
+
await act(() => {
|
|
46
|
+
tree = create(<UnitSummary {...defaultProps} index={1} len={2} />);
|
|
47
|
+
});
|
|
48
|
+
const instance = tree.root;
|
|
49
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
50
|
+
expect(TouchableOpacities[0].props.style).toEqual([
|
|
51
|
+
styles.summaryContainer,
|
|
52
|
+
{ borderBottomRightRadius: 10 },
|
|
53
|
+
]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('Test len % 2 !== 0 && index = len - 1', async () => {
|
|
57
|
+
await act(() => {
|
|
58
|
+
tree = create(<UnitSummary {...defaultProps} index={2} len={3} />);
|
|
59
|
+
});
|
|
60
|
+
const instance = tree.root;
|
|
61
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
62
|
+
expect(TouchableOpacities[0].props.style).toEqual([
|
|
63
|
+
styles.summaryContainer,
|
|
64
|
+
{ borderBottomLeftRadius: 10 },
|
|
65
|
+
]);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderer, { act } from 'react-test-renderer';
|
|
3
|
+
import { Text, TouchableOpacity } from 'react-native';
|
|
4
|
+
import UnitSummary from '..';
|
|
5
|
+
|
|
6
|
+
describe('UnitSummary components', () => {
|
|
7
|
+
let tree;
|
|
8
|
+
|
|
9
|
+
test('test render UnitSummary components', () => {
|
|
10
|
+
const summary = {
|
|
11
|
+
left_value: 'left_value test',
|
|
12
|
+
left_text: 'left_text test',
|
|
13
|
+
right_value: 'right_value test',
|
|
14
|
+
right_text: 'right_text test',
|
|
15
|
+
};
|
|
16
|
+
act(() => {
|
|
17
|
+
tree = renderer.create(<UnitSummary summary={summary} />);
|
|
18
|
+
});
|
|
19
|
+
const instance = tree.root;
|
|
20
|
+
const textElement = instance.findAllByType(Text);
|
|
21
|
+
|
|
22
|
+
expect(textElement[0].props.children).toEqual(summary.left_value);
|
|
23
|
+
expect(textElement[1].props.children).toEqual(summary.left_text);
|
|
24
|
+
expect(textElement[2].props.children).toEqual(summary.right_value);
|
|
25
|
+
expect(textElement[3].props.children).toEqual(summary.right_text);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('test onPress goToSummary', () => {
|
|
29
|
+
const summary = {
|
|
30
|
+
left_value: 'left_value test',
|
|
31
|
+
left_text: 'left_text test',
|
|
32
|
+
right_value: 'right_value test',
|
|
33
|
+
right_text: 'right_text test',
|
|
34
|
+
};
|
|
35
|
+
const mockFuntion = jest.fn();
|
|
36
|
+
act(() => {
|
|
37
|
+
tree = renderer.create(
|
|
38
|
+
<UnitSummary summary={summary} goToSummary={mockFuntion} />
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
const instance = tree.root;
|
|
42
|
+
const touchableOpacity = instance.findByType(TouchableOpacity);
|
|
43
|
+
act(() => {
|
|
44
|
+
touchableOpacity.props.onPress();
|
|
45
|
+
});
|
|
46
|
+
expect(mockFuntion).toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { Colors } from '../../../configs';
|
|
4
|
+
import styles from './indexstyles';
|
|
4
5
|
|
|
5
6
|
const UnitSummary = ({ summary, goToSummary, index, len }) => {
|
|
6
7
|
let RadiusProps = {};
|
|
@@ -65,41 +66,4 @@ const UnitSummary = ({ summary, goToSummary, index, len }) => {
|
|
|
65
66
|
);
|
|
66
67
|
};
|
|
67
68
|
|
|
68
|
-
const styles = StyleSheet.create({
|
|
69
|
-
summaryContainer: {
|
|
70
|
-
flex: 1,
|
|
71
|
-
flexDirection: 'row',
|
|
72
|
-
justifyContent: 'space-between',
|
|
73
|
-
borderWidth: 0.5,
|
|
74
|
-
borderColor: Colors.Gray4,
|
|
75
|
-
paddingHorizontal: 15,
|
|
76
|
-
paddingVertical: 10,
|
|
77
|
-
},
|
|
78
|
-
leftValue: {
|
|
79
|
-
fontWeight: 'bold',
|
|
80
|
-
fontSize: 16,
|
|
81
|
-
lineHeight: 24,
|
|
82
|
-
},
|
|
83
|
-
leftText: {
|
|
84
|
-
fontStyle: 'normal',
|
|
85
|
-
fontWeight: 'normal',
|
|
86
|
-
fontSize: 12,
|
|
87
|
-
lineHeight: 20,
|
|
88
|
-
},
|
|
89
|
-
rightValue: {
|
|
90
|
-
fontStyle: 'normal',
|
|
91
|
-
fontWeight: 'normal',
|
|
92
|
-
fontSize: 12,
|
|
93
|
-
lineHeight: 20,
|
|
94
|
-
top: 2,
|
|
95
|
-
},
|
|
96
|
-
rightText: {
|
|
97
|
-
fontStyle: 'normal',
|
|
98
|
-
fontWeight: 'normal',
|
|
99
|
-
fontSize: 10,
|
|
100
|
-
lineHeight: 20,
|
|
101
|
-
top: 4,
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
69
|
export default UnitSummary;
|