@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.
Files changed (84) hide show
  1. package/package.json +2 -8
  2. package/src/commons/ActionGroup/NumberUpDownActionTemplate.js +2 -1
  3. package/src/commons/ActionGroup/NumberUpDownActionTemplateStyle.js +4 -0
  4. package/src/commons/ActionGroup/OptionsDropdownActionTemplate.js +2 -1
  5. package/src/commons/ActionGroup/OptionsDropdownActionTemplateStyle.js +6 -0
  6. package/src/commons/ActionGroup/SliderRangeTemplate.js +4 -2
  7. package/src/commons/ActionGroup/SliderRangeTemplateStyles.js +1 -0
  8. package/src/commons/ActionGroup/StatesGridActionTemplate.js +2 -1
  9. package/src/commons/ActionGroup/StatesGridActionTemplateStyle.js +4 -0
  10. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefault.js +7 -1
  11. package/src/commons/ActionGroup/ThreeButtonTemplate/components/ThreeButtonDefaultStyles.js +8 -0
  12. package/src/commons/ActionGroup/ThreeButtonTemplate/index.js +3 -1
  13. package/src/commons/ActionGroup/ThreeButtonTemplate/styles.js +3 -0
  14. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +0 -5
  15. package/src/commons/ActionGroup/__test__/OneBigButtonTemplate.test.js +0 -5
  16. package/src/commons/Dashboard/MyUnit/__test__/MyUnit.test.js +24 -42
  17. package/src/commons/Dashboard/MyUnit/index.js +4 -2
  18. package/src/commons/DateTimeRangeChange/index.js +32 -4
  19. package/src/commons/Device/Emergency/EmergencyDetail.js +1 -1
  20. package/src/commons/Device/HistoryChart.js +52 -83
  21. package/src/commons/Device/PMSensor/PMSensorIndicator.js +3 -2
  22. package/src/commons/Device/PMSensor/PMSensorIndicatorStyles.js +3 -0
  23. package/src/commons/Device/ProgressBar/__test__/ProgressBar.test.js +0 -5
  24. package/src/commons/Device/ProgressBar/index.js +2 -2
  25. package/src/commons/Device/ProgressBar/styles.js +5 -0
  26. package/src/commons/Device/RainningSensor/CurrentRainSensor.js +5 -2
  27. package/src/commons/Device/WindDirection/Compass/index.js +9 -1
  28. package/src/commons/Device/WindSpeed/Anemometer/index.js +1 -4
  29. package/src/commons/FlatListDnD/index.js +31 -29
  30. package/src/commons/Form/TextInputPassword.js +2 -0
  31. package/src/commons/SelectActionCard/index.js +1 -1
  32. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +0 -7
  33. package/src/commons/Text/index.js +2 -2
  34. package/src/context/mockStore.ts +6 -1
  35. package/src/hooks/index.js +2 -1
  36. package/src/hooks/usePrevious.js +9 -0
  37. package/src/navigations/AddGatewayStack.js +0 -5
  38. package/src/screens/AQIGuide/__test__/AQIGuide.test.js +0 -5
  39. package/src/screens/ActivityLog/__test__/index.test.js +0 -9
  40. package/src/screens/AddNewGateway/SelectDeviceType.js +1 -1
  41. package/src/screens/Automate/AddNewAction/ChooseAction.js +19 -2
  42. package/src/screens/Automate/AddNewAction/Components/SelectDevices.js +2 -2
  43. package/src/screens/Automate/AddNewAction/NewActionWrapper.js +11 -7
  44. package/src/screens/Automate/AddNewAction/SelectControlDevices.js +4 -2
  45. package/src/screens/Automate/AddNewAutoSmart/__test__/AddNewAutoSmart.test.js +0 -7
  46. package/src/screens/Automate/EditActionsList/index.js +2 -2
  47. package/src/screens/Automate/OneTap/__test__/AddNewOneTap.test.js +0 -7
  48. package/src/screens/Automate/Scenario/__test__/AddNewOneTap.test.js +0 -7
  49. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +17 -1
  50. package/src/screens/Automate/ScriptDetail/index.js +8 -6
  51. package/src/screens/ChangePosition/__test__/index.test.js +4 -1
  52. package/src/screens/ChangePosition/index.js +23 -20
  53. package/src/screens/ChangePosition/styles.js +18 -3
  54. package/src/screens/Device/__test__/detail.test.js +147 -89
  55. package/src/screens/Device/__test__/mqttDetail.test.js +2 -15
  56. package/src/screens/Device/components/ChartWrapper.js +32 -26
  57. package/src/screens/Device/components/SensorDisplayItem.js +33 -16
  58. package/src/screens/Device/components/VisualChart.js +12 -3
  59. package/src/screens/Device/components/__test__/VisualChart.test.js +0 -7
  60. package/src/screens/Device/detail.js +13 -12
  61. package/src/screens/Device/hooks/useDeviceWatchConfigControl.js +10 -6
  62. package/src/screens/Device/styles.js +1 -1
  63. package/src/screens/Notification/__test__/NotificationItem.test.js +2 -0
  64. package/src/screens/PlayBackCamera/Styles/index.js +1 -1
  65. package/src/screens/PlayBackCamera/index.js +7 -7
  66. package/src/screens/SharedUnit/__test__/ShareUnit.test.js +0 -5
  67. package/src/screens/Sharing/__test__/SelectUser.test.js +0 -7
  68. package/src/screens/SmartAccount/index.js +20 -11
  69. package/src/screens/SubUnit/EditSubUnit.js +1 -2
  70. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +0 -9
  71. package/src/screens/SubUnit/__test__/Detail.test.js +0 -7
  72. package/src/screens/SubUnit/__test__/EditSubUnit.test.js +0 -12
  73. package/src/screens/TDSGuide/__test__/TDSGuide.test.js +0 -6
  74. package/src/screens/UVIndexGuide/__test__/UVIndexGuide.test.js +0 -6
  75. package/src/screens/Unit/__test__/CheckSendEmail.test.js +0 -11
  76. package/src/screens/Unit/__test__/Detail.test.js +0 -12
  77. package/src/screens/Unit/__test__/ManageUnit.test.js +0 -8
  78. package/src/screens/UnitSummary/components/PowerConsumption/index.js +4 -6
  79. package/src/screens/WaterQualityGuide/__test__/index.test.js +0 -5
  80. package/src/utils/I18n/translations/en.js +3 -1
  81. package/src/utils/I18n/translations/vi.js +3 -1
  82. package/src/utils/Route/index.js +0 -1
  83. package/src/screens/AddNewGateway/PlugAndPlay/ConnectRouterGuide.js +0 -49
  84. 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
- });