@eohjsc/react-native-smart-city 0.7.3 → 0.7.5
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/assets/images/Automation-fill.svg +85 -0
- package/assets/images/Map/LocationPin.svg +10 -0
- package/assets/images/Scenario-filled.svg +22 -0
- package/assets/images/schedule-fill.svg +48 -0
- package/package.json +20 -17
- package/src/commons/Action/ItemQuickAction.js +1 -1
- package/src/commons/Action/__test__/ItemQuickAction.test.js +6 -6
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/AutoLock/ButtonWrapper.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/__test__/index.test.js +5 -5
- package/src/commons/ActionGroup/OnOffSmartLock/PasscodeList/index.js +3 -3
- package/src/commons/ActionGroup/OnOffSmartLock/SetupGeneratePasscode/ButtonWrapper.js +2 -2
- package/src/commons/ActionGroup/OnOffTemplate/OnOffSimpleTemplate.js +2 -2
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SliderRangeTemplate.js +7 -7
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +2 -2
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +5 -5
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +5 -5
- package/src/commons/ActionGroup/TerminalBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/TextBoxTemplate.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonCircle.test.js +2 -2
- package/src/commons/ActionGroup/ThreeButtonTemplate/__test__/ThreeButtonDefault.test.js +2 -2
- package/src/commons/ActionGroup/TimerActionTemplate.js +6 -3
- package/src/commons/ActionGroup/TwoButtonTemplate/index.js +2 -2
- package/src/commons/ActionGroup/__test__/ColorPickerTemplate.test.js +9 -10
- package/src/commons/ActionGroup/__test__/OnOffSmartLock.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -5
- package/src/commons/ActionGroup/__test__/OptionsDropdownTemplate.test.js +8 -8
- package/src/commons/ActionGroup/__test__/StatesGridActionTemplate.test.js +3 -3
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +6 -6
- package/src/commons/ActionGroup/__test__/TwoButtonTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +6 -6
- package/src/commons/ActionGroup/index.js +2 -2
- package/src/commons/ActionTemplate/__test__/index.test.js +4 -4
- package/src/commons/Automate/ItemAutomate.js +9 -41
- package/src/commons/Automate/ItemConditionScriptDetail.js +67 -0
- package/src/commons/Automate/ItemConditionScriptDetailStyles.js +46 -0
- package/src/commons/Automate/__test__/ItemAutomate.test.js +0 -21
- package/src/commons/BackDefault/index.js +2 -2
- package/src/commons/BottomButtonView/index.js +1 -0
- package/src/commons/ButtonPopup/index.js +3 -2
- package/src/commons/ChartAggregationOption/__test__/FourButtonFilterHistory.test.js +2 -2
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +8 -9
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +7 -7
- package/src/commons/DateTimeRangeChange/DateTimeButton.js +3 -3
- package/src/commons/DateTimeRangeChange/index.js +1 -1
- package/src/commons/Device/ConnectedViewHeader.js +2 -2
- package/src/commons/Device/Emergency/EmergencyDetail.js +3 -3
- package/src/commons/Device/Emergency/__test__/EmergencyButton.test.js +1 -1
- package/src/commons/Device/FlatListItems.js +20 -19
- package/src/commons/Device/Hanet/ItemHanetDevice.js +3 -3
- package/src/commons/Device/Hanet/ItemHanetDevice.test.js +3 -3
- package/src/commons/Device/HorizontalBarChart.js +54 -34
- package/src/commons/Device/ItemAddNew/index.js +2 -2
- package/src/commons/Device/ItemDevice.js +5 -21
- package/src/commons/Device/SonosSpeaker/index.js +3 -3
- package/src/commons/Device/WaterPurifierStatus/AlertStatusMachine.js +2 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +6 -2
- package/src/commons/DisplayChecking/index.js +2 -2
- package/src/commons/EmergencyButton/AlertSendConfirm.js +2 -2
- package/src/commons/FieldTemplate/ChooseUserField/index.js +2 -2
- package/src/commons/FieldTemplate/PasscodeField/__test__/index.test.js +3 -3
- package/src/commons/FieldTemplate/ScheduleField/__test__/index.test.js +6 -6
- package/src/commons/FlatListDnD/__test__/index.test.js +4 -4
- package/src/commons/FlatListDnD/index.js +12 -9
- package/src/commons/Grid/GridItem.js +10 -2
- package/src/commons/GroupCheckBox/__test__/GroupCheckBox.test.js +3 -3
- package/src/commons/Header/HeaderCustom.js +2 -2
- package/src/commons/Header/__test__/HeaderCT.test.js +3 -3
- package/src/commons/HeaderAni/index.js +2 -2
- package/src/commons/IconComponent/index.js +3 -3
- package/src/commons/ImagePicker/__test__/ImagePicker.test.js +5 -5
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +6 -4
- package/src/commons/MenuActionMore/MenuActionMoreStyles.js +2 -1
- package/src/commons/MenuActionMore/index.js +1 -1
- package/src/commons/NavBar/NavBarStyles.js +1 -1
- package/src/commons/NavBar/index.js +2 -2
- package/src/commons/OneTapTemplate/NumberUpDownActionTemplate.js +3 -3
- package/src/commons/OneTapTemplate/__test__/StatesGridActionTemplate.test.js +1 -1
- package/src/commons/Popover/__test__/index.test.js +3 -3
- package/src/commons/Processing/__test__/Connecting.test.js +4 -4
- package/src/commons/SearchLocation/index.js +3 -3
- package/src/commons/SelectActionCard/index.js +2 -2
- package/src/commons/SelectSubUnit/index.js +6 -2
- package/src/commons/SelectUnit/__test__/SelectUnit.test.js +5 -5
- package/src/commons/Sharing/BtnRemoveMember.js +2 -2
- package/src/commons/Sharing/StationDevicePermissions.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigAndEvaluation/ConfigAndEvaluation.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/ConfigValue/ConfigValue.js +2 -2
- package/src/commons/SubUnit/DeviceTemplate/EvaluationOverConfig/EvaluationOverConfig.js +2 -2
- package/src/commons/SubUnit/OneTap/ItemOneTap.js +6 -7
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -2
- package/src/commons/SubUnit/OneTap/index.js +9 -8
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +8 -8
- package/src/commons/Unit/HeaderUnit/index.js +30 -22
- package/src/commons/Unit/SharedUnit.js +7 -7
- package/src/commons/Widgets/IFrame/__tests__/IFrame.test.js +9 -13
- package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +34 -2
- package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +88 -8
- package/src/commons/WrapParallaxScrollView/index.js +9 -10
- package/src/configs/API.js +1 -1
- package/src/configs/AccessibilityLabel.js +2 -0
- package/src/configs/Constants.js +3 -3
- package/src/configs/Theme.js +1 -1
- package/src/hooks/Common/__test__/useAndroidTranslucentStatusBar.test.js +5 -5
- package/src/hooks/IoT/__test__/useHomeAssistantConnection.test.js +12 -12
- package/src/hooks/IoT/__test__/useRemoteControl.test.js +14 -7
- package/src/hooks/IoT/__test__/useWatchConfigs.test.js +3 -3
- package/src/hooks/IoT/useRemoteControl.js +24 -13
- package/src/hooks/useMqtt.js +2 -2
- package/src/iot/RemoteControl/Bluetooth.js +19 -22
- package/src/iot/RemoteControl/Internet.js +13 -5
- package/src/iot/RemoteControl/__test__/Internet.test.js +7 -7
- package/src/navigations/EmergencyContactsStack.js +4 -3
- package/src/navigations/SharedStack.js +2 -0
- package/src/navigations/UnitStack.js +56 -57
- package/src/screens/AQIGuide/index.js +0 -2
- package/src/screens/ActivityLog/index.js +2 -2
- package/src/screens/AddLocationMaps/__test__/index.test.js +12 -12
- package/src/screens/AddLocationMaps/index.js +16 -19
- package/src/screens/AddLocationMaps/indexStyle.js +1 -0
- package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
- package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
- package/src/screens/AddNewGateway/ShareWifiPassword.js +16 -15
- package/src/screens/AddNewGateway/__test__/AddNewGateway.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/ConnectingWifiDevice.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +7 -7
- package/src/screens/AddNewGateway/__test__/RenameNewDevices.test.js +8 -8
- package/src/screens/AddNewGateway/__test__/ScanGatewayQR.test.js +5 -5
- package/src/screens/AddNewGateway/__test__/SelectDeviceUnit.test.js +4 -4
- package/src/screens/AddNewGateway/__test__/SelectModbusGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/SelectZigbeeGateway.test.js +6 -6
- package/src/screens/AddNewGateway/__test__/ShareWifiPassword.test.js +0 -4
- package/src/screens/AddNewGateway/hooks/__Tests__/useWifiManage.test.js +2 -2
- package/src/screens/AllGateway/DetailConfigActionModbus/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/DeviceInternalDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceModbusDetail/__test__/index.test.js +19 -17
- package/src/screens/AllGateway/DeviceZigbeeDetail/__test__/index.test.js +18 -16
- package/src/screens/AllGateway/GatewayDetail/__test__/index.test.js +43 -35
- package/src/screens/AllGateway/GatewayInfo/__test__/index.test.js +38 -22
- package/src/screens/AllGateway/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/components/Detail/__test__/index.test.js +3 -5
- package/src/screens/AllGateway/components/GatewayItem/__test__/index.test.js +3 -3
- package/src/screens/AllGateway/components/TabPaneCT/__test__/index.test.js +6 -6
- package/src/screens/AllGateway/hooks/__test__/index.test.js +2 -2
- package/src/screens/AllGateway/test-utils.js +3 -4
- package/src/screens/Automate/AddNewAction/ChooseAction.js +17 -3
- package/src/screens/Automate/AddNewAction/ChooseConfig.js +7 -6
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +8 -8
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +30 -20
- package/src/screens/Automate/AddNewAction/SelectMonitorDevices.js +17 -10
- package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +58 -44
- package/src/screens/Automate/AddNewAction/SetupScriptDelay.js +1 -1
- package/src/screens/Automate/AddNewAction/SetupScriptNotify.js +3 -3
- package/src/screens/Automate/AddNewAction/Styles/SetupSensorStyles.js +20 -4
- package/src/screens/Automate/AddNewAction/__test__/ChooseAction.test.js +12 -12
- package/src/screens/Automate/AddNewAction/__test__/SelectControlDevices.test.js +14 -8
- package/src/screens/Automate/AddNewAction/__test__/SelectMonitorDevices.test.js +13 -7
- package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +54 -15
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptDelay.test.js +9 -9
- package/src/screens/Automate/AddNewAction/__test__/SetupScriptNotify.test.js +39 -10
- package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +10 -10
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +13 -8
- package/src/screens/Automate/Components/InputName.js +10 -7
- package/src/screens/Automate/EditActionsList/__tests__/UpdateActionScript.test.js +8 -8
- package/src/screens/Automate/EditActionsList/__tests__/UpdateDelayScript.test.js +6 -6
- package/src/screens/Automate/EditActionsList/__tests__/UpdateNotifyScript.test.js +7 -7
- package/src/screens/Automate/EditActionsList/index.js +19 -17
- package/src/screens/Automate/MultiUnits.js +19 -22
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +18 -8
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +15 -7
- package/src/screens/Automate/ScriptDetail/Components/AddActionScript.js +14 -6
- package/src/screens/Automate/ScriptDetail/Components/RenameScript.js +4 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +56 -18
- package/src/screens/Automate/ScriptDetail/__test__/useStarredScript.test.js +6 -6
- package/src/screens/Automate/ScriptDetail/index.js +105 -41
- package/src/screens/Automate/SetSchedule/__test__/SelectWeekday.test.js +4 -4
- package/src/screens/Automate/SetSchedule/__test__/index.test.js +29 -18
- package/src/screens/Automate/SetSchedule/components/RowItem.js +5 -5
- package/src/screens/Automate/SetSchedule/index.js +8 -7
- package/src/screens/Automate/Styles/indexStyles.js +1 -1
- package/src/screens/Automate/__test__/MultiUnits.test.js +1 -4
- package/src/screens/Automate/__test__/index.test.js +0 -1
- package/src/screens/Automate/index.js +36 -34
- package/src/screens/ChangePosition/__test__/index.test.js +6 -6
- package/src/screens/ChangePosition/index.js +2 -1
- package/src/screens/Device/EditDevice/__test__/EditDevice.test.js +13 -13
- package/src/screens/Device/EditDevice/index.js +4 -4
- package/src/screens/Device/__test__/BluetoothDevice.test.js +300 -0
- package/src/screens/Device/__test__/detail.test.js +14 -14
- package/src/screens/Device/__test__/mqttDetail.test.js +9 -9
- package/src/screens/Device/components/BluetoothDevice.js +135 -0
- package/src/screens/Device/components/SensorDisplayItem.js +9 -8
- package/src/screens/Device/detail.js +70 -62
- package/src/screens/Device/hooks/useEvaluateValue.js +1 -1
- package/src/screens/Drawer/Drawer.test.js +2 -2
- package/src/screens/Drawer/index.js +3 -3
- package/src/screens/EmergencyContacts/EmergencyContactsList.js +8 -4
- package/src/screens/EmergencyContacts/EmergencyContactsSelectContacts.js +3 -3
- package/src/screens/EmergencyContacts/__test__/EmergencyContactsSelectContacts.test.js +7 -7
- package/src/screens/EmergencySetting/components/DropDownItem.js +2 -2
- package/src/screens/EnterPassword/__test__/EnterPassword.test.js +8 -8
- package/src/screens/GuestInfo/components/RowGuestInfo.js +2 -2
- package/src/screens/GuestInfo/components/__test__/AccessScheduleSheet.test.js +3 -3
- package/src/screens/GuestInfo/index.js +2 -2
- package/src/screens/HanetCamera/ManageAccess.js +3 -3
- package/src/screens/HanetCamera/MemberInfo.js +2 -2
- package/src/screens/HanetCamera/__test__/Detail.test.js +9 -9
- package/src/screens/HanetCamera/__test__/MemberInfo.test.js +10 -10
- package/src/screens/HanetCamera/components/RequestFaceIDPopup.js +2 -2
- package/src/screens/ManageAccess/index.js +3 -3
- package/src/screens/MoveToAnotherSubUnit/__test__/index.test.js +9 -9
- package/src/screens/Notification/__test__/Notification.test.js +9 -9
- package/src/screens/Notification/components/NotificationItem.js +3 -4
- package/src/screens/Notification/index.js +3 -3
- package/src/screens/Notification/styles/NotificationItemStyles.js +0 -1
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/__test__/QRScan.test.js +1 -1
- package/src/screens/ScanChipQR/components/QRScan/index.js +3 -3
- package/src/screens/SelectUnit/__test__/index.test.js +8 -8
- package/src/screens/SelectUnit/index.js +4 -4
- package/src/screens/SharedUnit/TabHeader.js +2 -2
- package/src/screens/Sharing/Components/EndDevice.js +3 -3
- package/src/screens/Sharing/UnitMemberList.js +2 -2
- package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +7 -7
- package/src/screens/SideMenuDetail/__test__/index.test.js +8 -8
- package/src/screens/SmartAccount/Connecting/index.js +5 -5
- package/src/screens/SmartAccount/ListDevice/__test__/ListDevice.test.js +8 -8
- package/src/screens/SmartAccount/SuccessfullyConnected/__test__/SuccessfullyConnected.test.js +7 -7
- package/src/screens/SmartAccount/SuccessfullyConnected/index.js +2 -2
- package/src/screens/SmartAccount/__test__/Connecting.test.js +6 -6
- package/src/screens/SmartAccount/__test__/SmartAccount.test.js +10 -10
- package/src/screens/SmartIr/__test__/GroupButtonByType.test.js +3 -2
- package/src/screens/SmartIr/components/GroupButtonByType/GroupButtonByType.js +2 -2
- package/src/screens/SmartIr/components/SelectBrand.js +2 -2
- package/src/screens/SubUnit/AddSubUnit.js +28 -26
- package/src/screens/SubUnit/AddSubUnitStyles.js +10 -4
- package/src/screens/SubUnit/EditSubUnit.js +12 -11
- package/src/screens/SubUnit/ManageSubUnit.js +3 -3
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +13 -13
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +3 -3
- package/src/screens/Template/EditTemplate.js +6 -4
- package/src/screens/Template/__test__/EditTemplate.test.js +7 -7
- package/src/screens/Template/__test__/detail.test.js +4 -4
- package/src/screens/Template/__test__/index.test.js +1 -1
- package/src/screens/UVIndexGuide/index.js +2 -4
- package/src/screens/Unit/Detail.js +1 -5
- package/src/screens/Unit/MoreMenu.js +6 -5
- package/src/screens/Unit/SelectAddToFavorites.js +2 -2
- package/src/screens/Unit/SelectAddress.js +16 -12
- package/src/screens/Unit/Station/__test__/index.test.js +1 -1
- package/src/screens/Unit/__test__/MoreMenu.test.js +5 -1
- package/src/screens/Unit/__test__/SelectAddToFavorites.test.js +9 -9
- package/src/screens/Unit/__test__/SelectAddress.test.js +11 -17
- package/src/screens/Unit/__test__/Summaries.test.js +7 -7
- package/src/screens/Unit/components/AutomateScript/index.js +5 -5
- package/src/screens/Unit/components/ButtonWrapper/index.js +3 -3
- package/src/screens/Unit/components/Header/index.js +2 -2
- package/src/screens/Unit/components/SharedUnit/index.js +5 -5
- package/src/screens/Unit/components/__test__/AutomateScript.test.js +3 -3
- package/src/screens/Unit/components/__test__/SharedUnit.test.js +8 -8
- package/src/screens/Unit/hook/__test__/useUnitConnectRemoteDevices.test.js +2 -2
- package/src/screens/UnitSummary/components/AirQuality/index.js +6 -11
- package/src/screens/UnitSummary/components/WaterQuality/Item/index.js +5 -5
- package/src/screens/UnitSummary/index.js +6 -2
- package/src/utils/Apis/axios.js +5 -5
- package/src/utils/Functions/ShortEmail.js +1 -0
- package/src/utils/I18n/translations/en.js +6 -3
- package/src/utils/I18n/translations/vi.js +8 -4
- package/src/utils/__test__/Utils.test.js +16 -16
- package/src/utils/bluetooth.js +3 -0
- package/assets/images/OneTap.svg +0 -14
- package/assets/images/Schedule.svg +0 -39
- package/assets/images/ValueChange.svg +0 -49
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { act, create } from 'react-test-renderer';
|
|
3
2
|
import DraggableFlatList from 'react-native-draggable-flatlist';
|
|
3
|
+
import { act, create } from 'react-test-renderer';
|
|
4
4
|
|
|
5
|
+
import { useRoute } from '@react-navigation/native';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
7
|
+
import Text from '../../../commons/Text';
|
|
5
8
|
import { SCProvider } from '../../../context';
|
|
6
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import EditTemplate from '../EditTemplate';
|
|
8
|
-
import Text from '../../../commons/Text';
|
|
9
|
-
import { useRoute } from '@react-navigation/native';
|
|
10
10
|
import { getTranslate } from '../../../utils/I18n';
|
|
11
|
-
import
|
|
11
|
+
import EditTemplate from '../EditTemplate';
|
|
12
12
|
|
|
13
13
|
const wrapComponent = () => (
|
|
14
14
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -67,7 +67,7 @@ describe('Test EditTemplate', () => {
|
|
|
67
67
|
await firstItem.props.onLongPress();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
expect(global.mockedGoBack).
|
|
70
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
71
71
|
|
|
72
72
|
await act(async () => {
|
|
73
73
|
await DraggableFlatLists[0].props.onDragEnd({
|
|
@@ -79,6 +79,6 @@ describe('Test EditTemplate', () => {
|
|
|
79
79
|
.findByProps({ accessibilityLabel: 'Save' })
|
|
80
80
|
.props.onPress();
|
|
81
81
|
});
|
|
82
|
-
expect(global.mockedGoBack).
|
|
82
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
83
83
|
});
|
|
84
84
|
});
|
|
@@ -4,13 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { TouchableOpacity } from 'react-native';
|
|
5
5
|
import { act, create } from 'react-test-renderer';
|
|
6
6
|
|
|
7
|
+
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
8
|
+
import ModalPopupCT from '../../../commons/ModalPopupCT';
|
|
7
9
|
import { API } from '../../../configs';
|
|
8
10
|
import { SCProvider } from '../../../context';
|
|
9
11
|
import { mockSCStore } from '../../../context/mockStore';
|
|
10
12
|
import api from '../../../utils/Apis/axios';
|
|
11
13
|
import Detail from '../detail';
|
|
12
|
-
import ModalPopupCT from '../../../commons/ModalPopupCT';
|
|
13
|
-
import MenuActionMore from '../../../commons/MenuActionMore';
|
|
14
14
|
|
|
15
15
|
const mock = new MockAdapter(api.axiosInstance);
|
|
16
16
|
|
|
@@ -59,7 +59,7 @@ describe('Test Detail', () => {
|
|
|
59
59
|
const instance = tree.root;
|
|
60
60
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
61
61
|
await touchableOpacities[0].props.onPress();
|
|
62
|
-
expect(global.mockedGoBack).
|
|
62
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('Test render onClick more header onPress delete', async () => {
|
|
@@ -95,7 +95,7 @@ describe('Test Detail', () => {
|
|
|
95
95
|
await act(async () => {
|
|
96
96
|
await menuActionMore.props.onItemClick(item);
|
|
97
97
|
});
|
|
98
|
-
expect(mockDoAction).
|
|
98
|
+
expect(mockDoAction).toHaveBeenCalled();
|
|
99
99
|
const modalPopupCT = instance.findByType(ModalPopupCT);
|
|
100
100
|
mock.onGet(API.DEV_MODE.DASHBOARD.DETAIL(1)).reply(200);
|
|
101
101
|
await act(async () => {
|
|
@@ -27,7 +27,7 @@ describe('Test Template screen', () => {
|
|
|
27
27
|
expect(FlatLists).toHaveLength(1);
|
|
28
28
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
29
29
|
await touchableOpacities[0].props.onPress();
|
|
30
|
-
expect(global.mockedNavigate).
|
|
30
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
it('Test onSearch', async () => {
|
|
@@ -2,16 +2,14 @@ import React, { memo, useMemo } from 'react';
|
|
|
2
2
|
import { ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
|
4
4
|
|
|
5
|
-
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
6
|
-
import { Colors, Theme } from '../../configs';
|
|
7
5
|
import Text from '../../commons/Text';
|
|
6
|
+
import { Colors, Theme } from '../../configs';
|
|
8
7
|
import { AccessibilityLabel } from '../../configs/Constants';
|
|
9
8
|
import { useSCContextSelector } from '../../context';
|
|
10
|
-
import
|
|
9
|
+
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
11
10
|
|
|
12
11
|
const UVIndexGuide = memo(() => {
|
|
13
12
|
const t = useTranslations();
|
|
14
|
-
useTitleHeader(t('UV Index Guide'));
|
|
15
13
|
const language = useSCContextSelector((state) => state.language);
|
|
16
14
|
|
|
17
15
|
const data = useMemo(
|
|
@@ -325,11 +325,7 @@ const UnitDetail = ({ route }) => {
|
|
|
325
325
|
}, [isFirstOpenCamera, isIOS]);
|
|
326
326
|
|
|
327
327
|
return (
|
|
328
|
-
<WrapParallaxScrollView
|
|
329
|
-
unit={unit}
|
|
330
|
-
unitData={unitData}
|
|
331
|
-
onRefresh={onRefresh}
|
|
332
|
-
>
|
|
328
|
+
<WrapParallaxScrollView unit={unit} onRefresh={onRefresh}>
|
|
333
329
|
{isFirstOpenCamera && isIOS && (
|
|
334
330
|
<MediaPlayerDetail
|
|
335
331
|
uri={Constants.URL_STREAM_CAMERA_DEMO}
|
|
@@ -14,6 +14,7 @@ const MoreMenu = ({
|
|
|
14
14
|
idLabelScrollView,
|
|
15
15
|
idLabelItem,
|
|
16
16
|
}) => {
|
|
17
|
+
const { id } = unit;
|
|
17
18
|
const t = useTranslations();
|
|
18
19
|
const navigation = useNavigation();
|
|
19
20
|
|
|
@@ -30,25 +31,25 @@ const MoreMenu = ({
|
|
|
30
31
|
id: 'mange-unit',
|
|
31
32
|
route: Routes.ManageUnit,
|
|
32
33
|
text: t('manage_unit'),
|
|
33
|
-
data: { unitId:
|
|
34
|
+
data: { unitId: id, unit },
|
|
34
35
|
};
|
|
35
36
|
const RouteUnitMemberList = {
|
|
36
37
|
id: 'unit-member',
|
|
37
38
|
route: Routes.UnitMemberList,
|
|
38
39
|
text: t('members'),
|
|
39
|
-
data: { unitId:
|
|
40
|
+
data: { unitId: id, unit },
|
|
40
41
|
};
|
|
41
42
|
const ListSmartAccount = {
|
|
42
43
|
id: 'smart-account',
|
|
43
44
|
route: Routes.ListSmartAccount,
|
|
44
45
|
text: t('smart_account'),
|
|
45
|
-
data: { unitId:
|
|
46
|
+
data: { unitId: id, unit },
|
|
46
47
|
};
|
|
47
48
|
const RouteAllGateway = {
|
|
48
49
|
id: 'all-gateway',
|
|
49
50
|
route: Routes.AllGateway,
|
|
50
51
|
text: t('all_gateway'),
|
|
51
|
-
data: { unitId:
|
|
52
|
+
data: { unitId: id, unit },
|
|
52
53
|
};
|
|
53
54
|
return isOwner
|
|
54
55
|
? [
|
|
@@ -58,7 +59,7 @@ const MoreMenu = ({
|
|
|
58
59
|
RouteAllGateway,
|
|
59
60
|
]
|
|
60
61
|
: [RouteUnitMemberList];
|
|
61
|
-
}, [t, unit, isOwner]);
|
|
62
|
+
}, [t, id, unit, isOwner]);
|
|
62
63
|
|
|
63
64
|
return (
|
|
64
65
|
<MenuActionMore
|
|
@@ -8,7 +8,7 @@ import React, {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import { View, ScrollView, TouchableOpacity } from 'react-native';
|
|
10
10
|
import { useNavigation } from '@react-navigation/native';
|
|
11
|
-
import
|
|
11
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
12
12
|
import { HeaderCustom } from '../../commons/Header';
|
|
13
13
|
import Text from '../../commons/Text';
|
|
14
14
|
import NavBar from '../../commons/NavBar';
|
|
@@ -142,7 +142,7 @@ const SelectAddToFavorites = memo(({ route }) => {
|
|
|
142
142
|
style={styles.buttonClose}
|
|
143
143
|
onPress={goBack}
|
|
144
144
|
>
|
|
145
|
-
<
|
|
145
|
+
<IconOutline name={'close'} size={24} color={Colors.Black} />
|
|
146
146
|
</TouchableOpacity>
|
|
147
147
|
),
|
|
148
148
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TouchableOpacity, View, ScrollView } from 'react-native';
|
|
3
|
-
import MapView, { Marker, Circle, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
2
|
import { useNavigation } from '@react-navigation/native';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { ScrollView, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import MapView, { Circle, Marker, PROVIDER_GOOGLE } from 'react-native-maps';
|
|
7
6
|
import { check, RESULTS } from 'react-native-permissions';
|
|
7
|
+
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
8
8
|
import { openPromptEnableLocation } from '../../utils/Setting/Location';
|
|
9
9
|
|
|
10
|
+
import { FullLoading } from '../../commons';
|
|
10
11
|
import BottomButtonView from '../../commons/BottomButtonView';
|
|
11
12
|
import SearchBarLocation from '../../commons/SearchLocation';
|
|
12
13
|
import RowLocation from '../../commons/SearchLocation/RowLocation';
|
|
13
14
|
import Text from '../../commons/Text';
|
|
14
|
-
import { FullLoading } from '../../commons';
|
|
15
15
|
import { useTranslations } from '../../hooks/Common/useTranslations';
|
|
16
16
|
import {
|
|
17
17
|
GEOLOCATION_ERROR,
|
|
@@ -19,15 +19,15 @@ import {
|
|
|
19
19
|
OpenSetting,
|
|
20
20
|
} from '../../utils/Permission/common';
|
|
21
21
|
|
|
22
|
-
import styles from './SelectAddressStyles';
|
|
23
22
|
import { API, Colors, SCConfig } from '../../configs';
|
|
24
|
-
import { axiosGet } from '../../utils/Apis/axios';
|
|
25
|
-
import Routes from '../../utils/Route';
|
|
26
23
|
import {
|
|
27
24
|
AccessibilityLabel,
|
|
28
|
-
MAP_INITIAL_REGION,
|
|
29
25
|
EOH_LOCATION,
|
|
26
|
+
MAP_INITIAL_REGION,
|
|
30
27
|
} from '../../configs/Constants';
|
|
28
|
+
import { axiosGet } from '../../utils/Apis/axios';
|
|
29
|
+
import Routes from '../../utils/Route';
|
|
30
|
+
import styles from './SelectAddressStyles';
|
|
31
31
|
|
|
32
32
|
navigator.geolocation = require('@react-native-community/geolocation');
|
|
33
33
|
|
|
@@ -210,7 +210,11 @@ const SelectAddress = memo(({ route }) => {
|
|
|
210
210
|
style={styles.button}
|
|
211
211
|
accessibilityLabel={AccessibilityLabel.BUTTON_CHOOSE_ON_MAP}
|
|
212
212
|
>
|
|
213
|
-
<
|
|
213
|
+
<IconOutline
|
|
214
|
+
name="environment"
|
|
215
|
+
size={27}
|
|
216
|
+
color={Colors.Primary}
|
|
217
|
+
/>
|
|
214
218
|
<Text type="Body" color={Colors.Gray9} style={styles.text} bold>
|
|
215
219
|
{t('choose_on_map')}
|
|
216
220
|
</Text>
|
|
@@ -248,7 +252,7 @@ const SelectAddress = memo(({ route }) => {
|
|
|
248
252
|
}}
|
|
249
253
|
tracksViewChanges={false}
|
|
250
254
|
>
|
|
251
|
-
<
|
|
255
|
+
<IconOutline name="environment" size={27} color={Colors.Blue10} />
|
|
252
256
|
</Marker>
|
|
253
257
|
</>
|
|
254
258
|
)}
|
|
@@ -52,6 +52,6 @@ describe('Test Station', () => {
|
|
|
52
52
|
});
|
|
53
53
|
const touchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
54
54
|
await touchableOpacities[0].props.onPress();
|
|
55
|
-
expect(mockOnSnapToItem).
|
|
55
|
+
expect(mockOnSnapToItem).toHaveBeenCalled();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -9,7 +9,11 @@ const mockHidePopover = jest.fn();
|
|
|
9
9
|
|
|
10
10
|
const wrapComponent = (showingPopover) => (
|
|
11
11
|
<SCProvider initState={mockSCStore({})}>
|
|
12
|
-
<MoreMenu
|
|
12
|
+
<MoreMenu
|
|
13
|
+
showingPopover={showingPopover}
|
|
14
|
+
hidePopover={mockHidePopover}
|
|
15
|
+
unit={{ id: 1 }}
|
|
16
|
+
/>
|
|
13
17
|
</SCProvider>
|
|
14
18
|
);
|
|
15
19
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { act, create } from 'react-test-renderer';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
4
|
|
|
5
|
+
import BottomButtonView from '../../../commons/BottomButtonView';
|
|
6
|
+
import NavBar from '../../../commons/NavBar';
|
|
7
|
+
import { API } from '../../../configs';
|
|
5
8
|
import { SCProvider } from '../../../context';
|
|
6
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
7
|
-
import
|
|
8
|
-
import NavBar from '../../../commons/NavBar';
|
|
10
|
+
import api from '../../../utils/Apis/axios';
|
|
9
11
|
import Device from '../../Automate/AddNewAction/Device';
|
|
10
12
|
import AutomateScript from '../components/AutomateScript';
|
|
11
|
-
import
|
|
12
|
-
import { API } from '../../../configs';
|
|
13
|
-
import api from '../../../utils/Apis/axios';
|
|
13
|
+
import SelectAddToFavorites from '../SelectAddToFavorites';
|
|
14
14
|
|
|
15
15
|
const wrapComponent = (route) => (
|
|
16
16
|
<SCProvider initState={mockSCStore({})}>
|
|
@@ -154,7 +154,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
154
154
|
await bottomButton.props.onPressMain();
|
|
155
155
|
});
|
|
156
156
|
expect(mock.history.post).toHaveLength(2);
|
|
157
|
-
expect(global.mockedGoBack).
|
|
157
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
158
158
|
});
|
|
159
159
|
|
|
160
160
|
it('test select only devices then click done', async () => {
|
|
@@ -187,7 +187,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
187
187
|
await bottomButton.props.onPressMain();
|
|
188
188
|
});
|
|
189
189
|
expect(mock.history.post).toHaveLength(1);
|
|
190
|
-
expect(global.mockedGoBack).
|
|
190
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
it('test select only scripts then click done', async () => {
|
|
@@ -216,7 +216,7 @@ describe('Test SelectAddToFavorites', () => {
|
|
|
216
216
|
await bottomButton.props.onPressMain();
|
|
217
217
|
});
|
|
218
218
|
expect(mock.history.post).toHaveLength(1);
|
|
219
|
-
expect(global.mockedGoBack).
|
|
219
|
+
expect(global.mockedGoBack).toHaveBeenCalled();
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
it('test click done call api fail not goBack', async () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Alert } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
4
|
import MockAdapter from 'axios-mock-adapter';
|
|
@@ -71,14 +71,6 @@ jest.mock('react-native-permissions', () => {
|
|
|
71
71
|
return require('react-native-permissions/mock');
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
jest.mock('react', () => {
|
|
75
|
-
return {
|
|
76
|
-
...jest.requireActual('react'),
|
|
77
|
-
memo: (x) => x,
|
|
78
|
-
useRef: jest.fn(),
|
|
79
|
-
};
|
|
80
|
-
});
|
|
81
|
-
|
|
82
74
|
describe('Test SelectAddress', () => {
|
|
83
75
|
let tree, route, Platform;
|
|
84
76
|
const mockUpdateLocation = jest.fn();
|
|
@@ -166,14 +158,16 @@ describe('Test SelectAddress', () => {
|
|
|
166
158
|
expect(global.mockedGoBack).toBeCalled();
|
|
167
159
|
});
|
|
168
160
|
|
|
161
|
+
// useRef same issue with src/commons/Widgets/IFrame/__tests__/IFrame.test.js
|
|
169
162
|
it('test chose search result will center map', async () => {
|
|
170
|
-
const animateToRegion = jest.fn();
|
|
171
|
-
const mapRef = {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
};
|
|
176
|
-
useRef.mockImplementation(() => mapRef);
|
|
163
|
+
// const animateToRegion = jest.fn();
|
|
164
|
+
// const mapRef = {
|
|
165
|
+
// current: {
|
|
166
|
+
// animateToRegion,
|
|
167
|
+
// },
|
|
168
|
+
// };
|
|
169
|
+
// useRef.mockImplementation(() => mapRef);
|
|
170
|
+
|
|
177
171
|
await act(async () => {
|
|
178
172
|
tree = await create(wrapComponent(route));
|
|
179
173
|
});
|
|
@@ -214,7 +208,7 @@ describe('Test SelectAddress', () => {
|
|
|
214
208
|
await act(async () => {
|
|
215
209
|
await rowLocations[0].props.onPress({ place_id: 1, description: '1' });
|
|
216
210
|
});
|
|
217
|
-
expect(animateToRegion).toBeCalled();
|
|
211
|
+
// expect(animateToRegion).toBeCalled();
|
|
218
212
|
});
|
|
219
213
|
|
|
220
214
|
it('test get lat lng of location failed', async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { useIsFocused } from '@react-navigation/native';
|
|
2
|
+
import MockAdapter from 'axios-mock-adapter';
|
|
1
3
|
import React from 'react';
|
|
2
4
|
import { ScrollView } from 'react-native';
|
|
3
|
-
import MockAdapter from 'axios-mock-adapter';
|
|
4
5
|
import renderer, { act } from 'react-test-renderer';
|
|
6
|
+
import SummaryItem from '../../../commons/SummaryItem';
|
|
5
7
|
import { API } from '../../../configs';
|
|
6
8
|
import { SCProvider } from '../../../context';
|
|
7
9
|
import { mockSCStore } from '../../../context/mockStore';
|
|
8
|
-
import Summaries from '../Summaries';
|
|
9
|
-
import SummaryItem from '../../../commons/SummaryItem';
|
|
10
|
-
import api from '../../../utils/Apis/axios';
|
|
11
10
|
import { useReceiveNotifications } from '../../../hooks';
|
|
12
|
-
import
|
|
11
|
+
import api from '../../../utils/Apis/axios';
|
|
12
|
+
import Summaries from '../Summaries';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -64,7 +64,7 @@ describe('Test Summaries', () => {
|
|
|
64
64
|
await act(async () => {
|
|
65
65
|
items[0].props.goToSummary({ id: 1 });
|
|
66
66
|
});
|
|
67
|
-
expect(global.mockedNavigate).
|
|
67
|
+
expect(global.mockedNavigate).toHaveBeenCalled();
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it('render Summaries receive noti with summary_id then not reload', async () => {
|
|
@@ -80,7 +80,7 @@ describe('Test Summaries', () => {
|
|
|
80
80
|
await act(async () => {
|
|
81
81
|
tree = await renderer.create(wrapComponent(props));
|
|
82
82
|
});
|
|
83
|
-
expect(global.mockedNavigate).not.
|
|
83
|
+
expect(global.mockedNavigate).not.toHaveBeenCalled();
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it('fetch data non-stop', async () => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, TouchableWithoutFeedback } from 'react-native';
|
|
3
|
-
import
|
|
3
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
4
4
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
5
5
|
import Text from '../../../../commons/Text';
|
|
6
6
|
import FImage from '../../../../commons/FImage';
|
|
7
|
-
import OneTap from '../../../../../assets/images/
|
|
8
|
-
import ValueChange from '../../../../../assets/images/
|
|
9
|
-
import Schedule from '../../../../../assets/images/
|
|
7
|
+
import OneTap from '../../../../../assets/images/Scenario-filled.svg';
|
|
8
|
+
import ValueChange from '../../../../../assets/images/Automation-fill.svg';
|
|
9
|
+
import Schedule from '../../../../../assets/images/schedule-fill.svg';
|
|
10
10
|
import Event from '../../../../../assets/images/Event.svg';
|
|
11
11
|
import styles from './styles';
|
|
12
12
|
import {
|
|
@@ -61,7 +61,7 @@ const AutomateScript = ({ automate, onPress, isSelected }) => {
|
|
|
61
61
|
<Text numberOfLines={1} type={'Label'} color={Colors.Gray7}>
|
|
62
62
|
{t('created_by', { name: author })}
|
|
63
63
|
</Text>
|
|
64
|
-
<
|
|
64
|
+
<IconOutline name="right" size={12} />
|
|
65
65
|
</View>
|
|
66
66
|
</View>
|
|
67
67
|
</View>
|
|
@@ -2,7 +2,7 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { View, TouchableOpacity, Image } from 'react-native';
|
|
3
3
|
import Text from '../../../../commons/Text';
|
|
4
4
|
import { Colors } from '../../../../configs';
|
|
5
|
-
import
|
|
5
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
6
6
|
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
7
7
|
import styles from './styles';
|
|
8
8
|
|
|
@@ -46,10 +46,10 @@ const ButtonWrapper = ({
|
|
|
46
46
|
<Image source={{ uri: value }} style={styles.avatar} />
|
|
47
47
|
) : (
|
|
48
48
|
<View style={styles.avatar}>
|
|
49
|
-
<
|
|
49
|
+
<IconOutline name={'user'} size={27} />
|
|
50
50
|
</View>
|
|
51
51
|
)}
|
|
52
|
-
<
|
|
52
|
+
<IconOutline name="right" size={20} color={Colors.Gray7} />
|
|
53
53
|
</View>
|
|
54
54
|
</View>
|
|
55
55
|
{children}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { Dimensions, View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import Popover from '../../../../commons/Popover';
|
|
4
|
-
import
|
|
4
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
5
5
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
6
6
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
7
7
|
|
|
@@ -98,7 +98,7 @@ const HeaderComponent = ({ title, goBack, dark, hideRight, style }) => {
|
|
|
98
98
|
onPress={() => setShowModal(true)}
|
|
99
99
|
style={styles.rightHeader}
|
|
100
100
|
>
|
|
101
|
-
<
|
|
101
|
+
<IconOutline
|
|
102
102
|
name="plus"
|
|
103
103
|
size={32}
|
|
104
104
|
color={dark ? Colors.Black : Colors.White}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { Fragment, useCallback } from 'react';
|
|
2
2
|
import { View, Image, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
4
|
-
import
|
|
4
|
+
import { IconFill, IconOutline } from '@ant-design/icons-react-native';
|
|
5
5
|
|
|
6
6
|
import { API, Colors, Images } from '../../../../configs';
|
|
7
7
|
import Text from '../../../../commons/Text';
|
|
@@ -88,7 +88,7 @@ const SharedUnit = ({
|
|
|
88
88
|
{isOptions && (
|
|
89
89
|
<Fragment>
|
|
90
90
|
{item.is_pin ? (
|
|
91
|
-
<
|
|
91
|
+
<IconOutline
|
|
92
92
|
name="pushpin"
|
|
93
93
|
size={20}
|
|
94
94
|
color={Colors.Blue10}
|
|
@@ -98,7 +98,7 @@ const SharedUnit = ({
|
|
|
98
98
|
}
|
|
99
99
|
/>
|
|
100
100
|
) : (
|
|
101
|
-
<
|
|
101
|
+
<IconOutline
|
|
102
102
|
name="pushpin"
|
|
103
103
|
size={20}
|
|
104
104
|
onPress={addPinSharedUnit}
|
|
@@ -106,7 +106,7 @@ const SharedUnit = ({
|
|
|
106
106
|
/>
|
|
107
107
|
)}
|
|
108
108
|
{item.is_star ? (
|
|
109
|
-
<
|
|
109
|
+
<IconFill
|
|
110
110
|
name="star"
|
|
111
111
|
size={20}
|
|
112
112
|
color={Colors.Yellow6}
|
|
@@ -116,7 +116,7 @@ const SharedUnit = ({
|
|
|
116
116
|
}
|
|
117
117
|
/>
|
|
118
118
|
) : (
|
|
119
|
-
<
|
|
119
|
+
<IconOutline
|
|
120
120
|
name="star"
|
|
121
121
|
size={20}
|
|
122
122
|
onPress={addStarSharedUnit}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TouchableWithoutFeedback, View } from 'react-native';
|
|
3
3
|
import { act, create } from 'react-test-renderer';
|
|
4
|
+
import FImage from '../../../../commons/FImage';
|
|
5
|
+
import Text from '../../../../commons/Text';
|
|
4
6
|
import { AUTOMATE_TYPE } from '../../../../configs/Constants';
|
|
5
7
|
import { SCProvider } from '../../../../context';
|
|
6
8
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
7
9
|
import AutomateScript from '../AutomateScript';
|
|
8
|
-
import Text from '../../../../commons/Text';
|
|
9
|
-
import FImage from '../../../../commons/FImage';
|
|
10
10
|
|
|
11
11
|
const mockOnPress = jest.fn();
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ describe('test AutomateScript screen', () => {
|
|
|
34
34
|
TouchableWithoutFeedback
|
|
35
35
|
);
|
|
36
36
|
await TouchableWithoutFeedbacks[0].props.onPress();
|
|
37
|
-
expect(mockOnPress).
|
|
37
|
+
expect(mockOnPress).toHaveBeenCalledWith(automate);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('Test isSelected=true', async () => {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { create, act } from 'react-test-renderer';
|
|
3
|
-
import moment from 'moment';
|
|
4
1
|
import { useNavigation } from '@react-navigation/native';
|
|
5
2
|
import MockAdapter from 'axios-mock-adapter';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import moment from 'moment';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { act, create } from 'react-test-renderer';
|
|
8
6
|
import { API } from '../../../../configs';
|
|
9
|
-
import
|
|
7
|
+
import { AccessibilityLabel } from '../../../../configs/Constants';
|
|
10
8
|
import { SCProvider } from '../../../../context';
|
|
11
9
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
12
10
|
import api from '../../../../utils/Apis/axios';
|
|
11
|
+
import Routes from '../../../../utils/Route';
|
|
12
|
+
import SharedUnit from '../SharedUnit';
|
|
13
13
|
|
|
14
14
|
const mock = new MockAdapter(api.axiosInstance);
|
|
15
15
|
|
|
@@ -114,7 +114,7 @@ describe('Test SharedUnit', () => {
|
|
|
114
114
|
);
|
|
115
115
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
116
116
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
117
|
-
expect(mockRenewItem).
|
|
117
|
+
expect(mockRenewItem).toHaveBeenCalled();
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('test create SharedUnit unit is pin, is star with call api failure', async () => {
|
|
@@ -140,6 +140,6 @@ describe('Test SharedUnit', () => {
|
|
|
140
140
|
);
|
|
141
141
|
mock.onPost(API.UNIT.UNSTAR_UNIT(3)).reply(200);
|
|
142
142
|
await iconRemoveStarSharedUnit.props.onPress();
|
|
143
|
-
expect(mockRenewItem).
|
|
143
|
+
expect(mockRenewItem).toHaveBeenCalled();
|
|
144
144
|
});
|
|
145
145
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { renderHook } from '@testing-library/react-hooks';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { SCProvider } from '../../../../context';
|
|
4
4
|
import { mockSCStore } from '../../../../context/mockStore';
|
|
5
5
|
import { useUnitConnectRemoteDevices } from '../useUnitConnectRemoteDevices';
|
|
@@ -52,6 +52,6 @@ describe('Test useUnitConnectRemoteDevices', () => {
|
|
|
52
52
|
renderHook(() => useUnitConnectRemoteDevices(unit), {
|
|
53
53
|
wrapper,
|
|
54
54
|
});
|
|
55
|
-
expect(mockSetAction).not.
|
|
55
|
+
expect(mockSetAction).not.toHaveBeenCalled();
|
|
56
56
|
});
|
|
57
57
|
});
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
1
2
|
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
2
3
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import AntDesign from 'react-native-vector-icons/AntDesign';
|
|
4
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
5
4
|
|
|
6
5
|
import styles from './styles';
|
|
7
6
|
|
|
8
7
|
import { Section, Text } from '../../../../commons';
|
|
9
|
-
import VisualChart from '../../../Device/components/VisualChart';
|
|
10
|
-
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
11
|
-
import { useWatchConfigs } from '../../../../hooks/IoT';
|
|
12
8
|
import { Colors } from '../../../../configs';
|
|
13
9
|
import AccessibilityLabel from '../../../../configs/AccessibilityLabel';
|
|
10
|
+
import { useTranslations } from '../../../../hooks/Common/useTranslations';
|
|
11
|
+
import { useWatchConfigs } from '../../../../hooks/IoT';
|
|
12
|
+
import VisualChart from '../../../Device/components/VisualChart';
|
|
14
13
|
import SegmentedRoundChart from './SegmentedRoundChart';
|
|
15
14
|
|
|
16
15
|
const AirQuality = memo(({ summaryDetail }) => {
|
|
@@ -80,7 +79,7 @@ const AirQuality = memo(({ summaryDetail }) => {
|
|
|
80
79
|
<View
|
|
81
80
|
style={[styles.boxEmotion, { backgroundColor: outdoorColor }]}
|
|
82
81
|
>
|
|
83
|
-
<
|
|
82
|
+
<IconOutline name={outdoorIcon} size={35} />
|
|
84
83
|
</View>
|
|
85
84
|
<View
|
|
86
85
|
style={[
|
|
@@ -122,11 +121,7 @@ const AirQuality = memo(({ summaryDetail }) => {
|
|
|
122
121
|
{<SegmentedRoundChart data={outdoor} />}
|
|
123
122
|
{!!advices?.length && (
|
|
124
123
|
<View style={styles.boxHealth}>
|
|
125
|
-
<
|
|
126
|
-
name="alert-circle-outline"
|
|
127
|
-
size={20}
|
|
128
|
-
style={styles.iconMargin}
|
|
129
|
-
/>
|
|
124
|
+
<IconOutline name="alert" size={20} style={styles.iconMargin} />
|
|
130
125
|
<Text semibold color={Colors.Gray9} type="H4">
|
|
131
126
|
{t('Health advices:')}
|
|
132
127
|
</Text>
|