@eohjsc/react-native-smart-city 0.4.0 → 0.4.1
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/package.json +2 -8
- package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +2 -1
- package/src/commons/ActionGroup/NumberUpDownActionTemplateStyle.js +4 -0
- package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
- package/src/commons/ActionGroup/OptionsDropdownActionTemplateStyle.js +6 -0
- package/src/commons/ActionGroup/SliderRangeTemplate.js +4 -2
- package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +1 -0
- package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
- package/src/commons/ActionGroup/StatesGridActionTemplateStyle.js +4 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefault.js +7 -1
- package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefaultStyles.js +8 -0
- package/src/commons/ActionGroup/ThreeButtonTemplate/index.js +3 -1
- package/src/commons/ActionGroup/ThreeButtonTemplate/styles.js +3 -0
- package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +0 -5
- package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +0 -5
- package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +24 -42
- package/src/commons/Dashboard/MyUnit/index.js +4 -2
- package/src/commons/DateTimeRangeChange/index.js +32 -4
- package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
- package/src/commons/Device/HistoryChart.js +52 -83
- package/src/commons/Device/PMSensor/PMSensorIndicator.js +3 -2
- package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
- package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +0 -5
- package/src/commons/Device/ProgressBar/index.js +2 -2
- package/src/commons/Device/ProgressBar/styles.js +5 -0
- package/src/commons/Device/RainningSensor/CurrentRainSensor.js +5 -2
- package/src/commons/Device/WindDirection/Compass/index.js +9 -1
- package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -4
- package/src/commons/FlatListDnD/index.js +31 -29
- package/src/commons/Form/TextInputPassword.js +2 -0
- package/src/commons/SelectActionCard/index.js +1 -1
- package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -7
- package/src/commons/Text/index.js +2 -2
- package/src/context/mockStore.ts +6 -1
- package/src/hooks/index.js +2 -1
- package/src/hooks/usePrevious.js +9 -0
- package/src/navigations/AddGatewayStack.js +0 -5
- package/src/screens/AQIGuide/__test__/AQIGuide.test.js +0 -5
- package/src/screens/ActivityLog/__test__/index.test.js +0 -9
- package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
- package/src/screens/Automate/AddNewAction/ChooseAction.js +19 -2
- package/src/screens/Automate/AddNewAction/Components/SelectDevices.js +2 -2
- package/src/screens/Automate/AddNewAction/NewActionWrapper.js +11 -7
- package/src/screens/Automate/AddNewAction/SelectControlDevices.js +4 -2
- package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +0 -7
- package/src/screens/Automate/EditActionsList/index.js +2 -2
- package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +0 -7
- package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +0 -7
- package/src/screens/Automate/ScriptDetail/__test__/index.test.js +17 -1
- package/src/screens/Automate/ScriptDetail/index.js +8 -6
- package/src/screens/ChangePosition/__test__/index.test.js +4 -1
- package/src/screens/ChangePosition/index.js +23 -20
- package/src/screens/ChangePosition/styles.js +18 -3
- package/src/screens/Device/__test__/detail.test.js +147 -89
- package/src/screens/Device/__test__/mqttDetail.test.js +2 -15
- package/src/screens/Device/components/ChartWrapper.js +32 -26
- package/src/screens/Device/components/SensorDisplayItem.js +33 -16
- package/src/screens/Device/components/VisualChart.js +12 -3
- package/src/screens/Device/components/__test__/VisualChart.test.js +0 -7
- package/src/screens/Device/detail.js +13 -12
- package/src/screens/Device/hooks/useDeviceWatchConfigControl.js +10 -6
- package/src/screens/Device/styles.js +1 -1
- package/src/screens/Notification/__test__/NotificationItem.test.js +2 -0
- package/src/screens/PlayBackCamera/Styles/index.js +1 -1
- package/src/screens/PlayBackCamera/index.js +7 -7
- package/src/screens/SharedUnit/__test__/ShareUnit.test.js +0 -5
- package/src/screens/Sharing/__test__/SelectUser.test.js +0 -7
- package/src/screens/SmartAccount/index.js +20 -11
- package/src/screens/SubUnit/EditSubUnit.js +1 -2
- package/src/screens/SubUnit/__test__/AddSubUnit.test.js +0 -9
- package/src/screens/SubUnit/__test__/Detail.test.js +0 -7
- package/src/screens/SubUnit/__test__/EditSubUnit.test.js +0 -12
- package/src/screens/TDSGuide/__test__/TDSGuide.test.js +0 -6
- package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +0 -6
- package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -11
- package/src/screens/Unit/__test__/Detail.test.js +0 -12
- package/src/screens/Unit/__test__/ManageUnit.test.js +0 -8
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +4 -6
- package/src/screens/WaterQualityGuide/__test__/index.test.js +0 -5
- package/src/utils/I18n/translations/en.js +3 -1
- package/src/utils/I18n/translations/vi.js +3 -1
- package/src/utils/Route/index.js +0 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectRouterGuide.js +0 -49
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/ConnectRouterGuide.test.js +0 -68
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import renderer, { act, create } from 'react-test-renderer';
|
|
3
|
-
|
|
4
|
-
import ConnectRouterGuide from '../ConnectRouterGuide';
|
|
5
|
-
import { Text } from 'react-native';
|
|
6
|
-
import { getTranslate } from '../../../../utils/I18n';
|
|
7
|
-
import { SCProvider } from '../../../../context';
|
|
8
|
-
import { mockSCStore } from '../../../../context/mockStore';
|
|
9
|
-
import { ViewButtonBottom } from '../../../../commons';
|
|
10
|
-
import Routes from '../../../../utils/Route';
|
|
11
|
-
|
|
12
|
-
const mockedGoBack = jest.fn();
|
|
13
|
-
const mockedNavigate = jest.fn();
|
|
14
|
-
jest.mock('@react-navigation/native', () => {
|
|
15
|
-
return {
|
|
16
|
-
...jest.requireActual('@react-navigation/native'),
|
|
17
|
-
useNavigation: () => ({
|
|
18
|
-
navigate: mockedNavigate,
|
|
19
|
-
goBack: mockedGoBack,
|
|
20
|
-
}),
|
|
21
|
-
useIsFocused: () => ({}),
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const wrapComponent = (route) => (
|
|
26
|
-
<SCProvider initState={mockSCStore({})}>
|
|
27
|
-
<ConnectRouterGuide route={route} />
|
|
28
|
-
</SCProvider>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
describe('Test ConnectRouterGuide', () => {
|
|
32
|
-
let tree;
|
|
33
|
-
|
|
34
|
-
beforeEach(async () => {
|
|
35
|
-
mockedNavigate.mockClear();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('create', async () => {
|
|
39
|
-
await act(async () => {
|
|
40
|
-
tree = await create(wrapComponent({ params: {} }));
|
|
41
|
-
});
|
|
42
|
-
const instance = tree.root;
|
|
43
|
-
const texts = instance.findAllByType(Text);
|
|
44
|
-
expect(texts[1].props.children).toEqual(
|
|
45
|
-
getTranslate('en', 'connect_to_router')
|
|
46
|
-
);
|
|
47
|
-
expect(texts[2].props.children).toEqual(
|
|
48
|
-
getTranslate('en', 'connect_router_content')
|
|
49
|
-
);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
const rightClick = async (params) => {
|
|
53
|
-
await act(async () => {
|
|
54
|
-
tree = await renderer.create(wrapComponent({ params }));
|
|
55
|
-
});
|
|
56
|
-
const instance = tree.root;
|
|
57
|
-
const viewButtonBottom = instance.findByType(ViewButtonBottom);
|
|
58
|
-
await act(async () => {
|
|
59
|
-
viewButtonBottom.props.onRightClick();
|
|
60
|
-
});
|
|
61
|
-
expect(mockedNavigate).toHaveBeenCalled();
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
it('test click next', async () => {
|
|
65
|
-
await rightClick();
|
|
66
|
-
expect(mockedNavigate.mock.calls[0][0]).toEqual(Routes.SelectZigbeeGateway);
|
|
67
|
-
});
|
|
68
|
-
});
|