@eohjsc/react-native-smart-city 0.7.20 → 0.7.22

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 (67) hide show
  1. package/assets/images/Schedule.svg +39 -0
  2. package/assets/images/ValueChange.svg +49 -0
  3. package/package.json +1 -1
  4. package/src/Images/Common/default_end_device.png +0 -0
  5. package/src/commons/Automate/ButtonAddCondition.js +51 -0
  6. package/src/commons/Automate/ItemConditionScriptDetail.js +28 -15
  7. package/src/commons/Automate/ItemConditionScriptDetailStyles.js +9 -0
  8. package/src/commons/Dashboard/MyUnit/index.js +19 -20
  9. package/src/commons/DevMode/Search.js +1 -1
  10. package/src/commons/Device/RainningSensor/CurrentRainSensor.js +5 -5
  11. package/src/commons/Widgets/IFrameWithConfig/IFrameWithConfig.js +1 -3
  12. package/src/commons/Widgets/IFrameWithConfig/__tests__/IFrameWithConfig.test.js +1 -1
  13. package/src/configs/API.js +16 -1
  14. package/src/configs/AccessibilityLabel.js +9 -1
  15. package/src/configs/Images.js +1 -0
  16. package/src/context/actionType.ts +5 -0
  17. package/src/context/reducer.ts +30 -1
  18. package/src/navigations/AddMemberStack.js +3 -3
  19. package/src/navigations/UnitStack.js +8 -0
  20. package/src/screens/AddCommon/SelectUnit.js +3 -2
  21. package/src/screens/AddLocationMaps/__test__/index.test.js +13 -13
  22. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +73 -30
  23. package/src/screens/Automate/AddNewAction/__test__/ChooseConfig.test.js +9 -11
  24. package/src/screens/Automate/AddNewAction/__test__/SetupConfigCondition.test.js +115 -10
  25. package/src/screens/Automate/AddNewAutoSmart/AddTypeSmart.js +7 -3
  26. package/src/screens/Automate/AddNewAutoSmart/__test__/AddAutomationTypeSmart.test.js +31 -0
  27. package/src/screens/Automate/ScriptDetail/Components/DeleteCondition.js +51 -0
  28. package/src/screens/Automate/ScriptDetail/Components/ModalAddCondition.js +196 -0
  29. package/src/screens/Automate/ScriptDetail/Styles/indexStyles.js +18 -0
  30. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +441 -47
  31. package/src/screens/Automate/ScriptDetail/index.js +359 -72
  32. package/src/screens/Automate/ScriptDetail/utils.js +7 -31
  33. package/src/screens/Automate/SetSchedule/AddEditConditionSchedule.js +173 -0
  34. package/src/screens/Automate/SetSchedule/__test__/AddEditConditionSchedule.test.js +211 -0
  35. package/src/screens/ConfirmUnitDeletion/__test__/ConfirmUnitDeletion.test.js +69 -13
  36. package/src/screens/ConfirmUnitDeletion/index.js +14 -14
  37. package/src/screens/Sharing/Components/ConfigItem.js +34 -0
  38. package/src/screens/Sharing/Components/DeviceItem.js +77 -0
  39. package/src/screens/Sharing/Components/ItemChangeRole.js +3 -4
  40. package/src/screens/Sharing/Components/ShareDeviceSelector.js +255 -0
  41. package/src/screens/Sharing/Components/Styles/CheckBoxCustomStyles.js +1 -1
  42. package/src/screens/Sharing/Components/Styles/DeviceItemStyles.js +11 -27
  43. package/src/screens/Sharing/{Styles/SelectPermissionStyles.js → Components/Styles/ShareDeviceSelectorStyles.js} +3 -11
  44. package/src/screens/Sharing/Components/SubUnitItem.js +28 -0
  45. package/src/screens/Sharing/Components/SubUnitTreeView.js +68 -0
  46. package/src/screens/Sharing/Components/TitleCheckBox.js +23 -41
  47. package/src/screens/Sharing/Components/__test__/ItemChangeRole.test.js +7 -7
  48. package/src/screens/Sharing/Components/__test__/ShareDeviceSelector.test.js +298 -0
  49. package/src/screens/Sharing/Components/index.js +14 -1
  50. package/src/screens/Sharing/InfoMemberUnit.js +20 -20
  51. package/src/screens/Sharing/SelectShareDevice.js +11 -255
  52. package/src/screens/Sharing/SelectUser.js +12 -12
  53. package/src/screens/Sharing/UpdateShareDevice.js +45 -301
  54. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +58 -11
  55. package/src/screens/Sharing/__test__/SelectShareDevice.test.js +51 -160
  56. package/src/screens/Sharing/__test__/SelectUser.test.js +72 -10
  57. package/src/screens/Sharing/__test__/UpdateShareDevice.test.js +49 -209
  58. package/src/utils/I18n/translations/en.js +22 -1
  59. package/src/utils/I18n/translations/vi.js +23 -3
  60. package/src/utils/Route/index.js +1 -0
  61. package/src/commons/Sharing/StationDevicePermissions.js +0 -204
  62. package/src/screens/Sharing/Components/CheckBoxConfig.js +0 -44
  63. package/src/screens/Sharing/Components/CheckBoxSubUnit.js +0 -35
  64. package/src/screens/Sharing/Components/EndDevice.js +0 -93
  65. package/src/screens/Sharing/Components/Styles/CheckBoxConfigStyles.js +0 -18
  66. package/src/screens/Sharing/Components/Styles/TitleCheckBoxStyles.js +0 -21
  67. package/src/screens/Sharing/Components/__test__/TitleCheckBox.test.js +0 -31
@@ -1,32 +1,32 @@
1
- import React, { useCallback, useMemo, useState } from 'react';
1
+ import { API, Colors, Theme } from '../../configs';
2
+ import { Button, ViewButtonBottom } from '../../commons';
2
3
  import {
3
4
  Keyboard,
4
5
  StyleSheet,
5
6
  TouchableWithoutFeedback,
6
7
  View,
7
8
  } from 'react-native';
8
- import { useNavigation } from '@react-navigation/native';
9
- import { getStatusBarHeight } from 'react-native-iphone-x-helper';
10
-
11
- import { useTranslations } from '../../hooks/Common/useTranslations';
12
- import { API, Colors, Theme } from '../../configs';
13
- import AccountList from '../../commons/Auth/AccountList';
14
- import _TextInput from '../../commons/Form/TextInput';
15
- import { ViewButtonBottom, Button } from '../../commons';
9
+ import React, { useCallback, useMemo, useState } from 'react';
10
+ import { axiosGet, axiosPost } from '../../utils/Apis/axios';
16
11
  import {
17
12
  isValidEmailAddress,
18
13
  isValidPhoneNumber,
19
14
  } from '../../utils/Validation';
20
- import { axiosGet, axiosPost } from '../../utils/Apis/axios';
15
+
21
16
  import { AccessibilityLabel } from '../../configs/Constants';
17
+ import AccountList from '../../commons/Auth/AccountList';
18
+ import Routes from '../../utils/Route';
22
19
  import Text from '../../commons/Text';
23
20
  import { ToastBottomHelper } from '../../utils/Utils';
24
- import Routes from '../../utils/Route';
21
+ import _TextInput from '../../commons/Form/TextInput';
22
+ import { getStatusBarHeight } from 'react-native-iphone-x-helper';
23
+ import { useNavigation } from '@react-navigation/native';
24
+ import { useTranslations } from '../../hooks/Common/useTranslations';
25
25
 
26
26
  const SharingInviteMembers = ({ route }) => {
27
27
  const t = useTranslations();
28
28
  const { goBack, navigate } = useNavigation();
29
- const { unit, permissions } = route?.params || {};
29
+ const { unit, permissions } = route?.params;
30
30
  const [errorText, setErrorText] = useState('');
31
31
  const [content, setContent] = useState('');
32
32
  const [users, setUsers] = useState([]);
@@ -1,322 +1,66 @@
1
- import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
2
- import { View, FlatList, Alert, ActivityIndicator } from 'react-native';
3
- import { useNavigation } from '@react-navigation/native';
1
+ import React, { useCallback, useEffect, useState } from 'react';
2
+ import { axiosGet, axiosPost } from '../../utils/Apis/axios';
4
3
 
4
+ import { API } from '../../configs';
5
+ import { ShareDeviceSelector } from './Components';
6
+ import { useNavigation } from '@react-navigation/native';
5
7
  import { useTranslations } from '../../hooks/Common/useTranslations';
6
- import ViewButtonBottom from '../../commons/ViewButtonBottom';
7
- import Text from '../../commons/Text';
8
- import styles from './Styles/SelectPermissionStyles';
9
- import { axiosGet, axiosPost } from '../../utils/Apis/axios';
10
- import { objectIds } from '../../utils/Utils';
11
- import { API, Colors } from '../../configs';
12
- import { AccessibilityLabel } from '../../configs/Constants';
13
- import CheckBoxSubUnit from './Components/CheckBoxSubUnit';
14
- import EndDevice from './Components/EndDevice';
15
8
 
16
9
  const UpdateShareDevice = ({ route }) => {
17
- const t = useTranslations();
18
10
  const { unit, member } = route.params;
19
11
  const navigation = useNavigation();
20
- const [dataStations, setDataStations] = useState([]);
21
- const [isTickAllDevices, setIsTickAllDevices] = useState(false);
22
- const [expandedItemIds, setExpandedItemIds] = useState([]);
23
- const [loading, setLoading] = useState(true);
24
- const [needRefresh, setNeedRefresh] = useState(false);
25
-
26
- const onTickAllDevices = (indexSubUnit, isChecked) => {
27
- setIsTickAllDevices(isChecked);
28
- const updatedDataStations = dataStations.map((station) => ({
29
- ...station,
30
- isChecked,
31
- devices: station.devices.map((device) => ({
32
- ...device,
33
- isChecked,
34
- actions: device.actions.map((action) => ({
35
- ...action,
36
- isChecked,
37
- })),
38
- read_configs: device.read_configs.map((config) => ({
39
- ...config,
40
- isChecked,
41
- })),
42
- })),
43
- }));
44
- setDataStations(updatedDataStations);
45
- };
46
-
47
- const onTickSubUnit = (indexSubUnit, isChecked) => {
48
- dataStations[indexSubUnit] = {
49
- ...dataStations[indexSubUnit],
50
- isChecked,
51
- devices: dataStations[indexSubUnit].devices.map((i) => ({
52
- ...i,
53
- isChecked,
54
- actions: i.actions.map((j) => ({ ...j, isChecked })),
55
- read_configs: i.read_configs.map((j) => ({ ...j, isChecked })),
56
- })),
57
- };
58
- setDataStations(dataStations);
59
- setIsTickAllDevices(!dataStations.some((object) => !object.isChecked));
60
- setNeedRefresh(true);
61
- };
62
-
63
- const onTickEndDevice = (indexSubUnit, indexEndDevice, item, isChecked) => {
64
- item.isChecked = isChecked;
65
- item.actions = item.actions.map((j) => ({ ...j, isChecked }));
66
- item.read_configs = item.read_configs.map((j) => ({ ...j, isChecked }));
67
-
68
- dataStations[indexSubUnit].devices[indexEndDevice] = item;
69
-
70
- dataStations[indexSubUnit] = {
71
- ...dataStations[indexSubUnit],
72
- isChecked:
73
- dataStations[indexSubUnit].devices.length ===
74
- dataStations[indexSubUnit].devices.filter((i) => i.isChecked).length,
75
- };
76
- setIsTickAllDevices(!dataStations.some((i) => !i.isChecked));
77
- setDataStations(dataStations);
78
- setNeedRefresh(true);
79
- };
80
-
81
- const onTickedChild = (
82
- indexSubUnit,
83
- indexEndDevice,
84
- configId,
85
- item,
86
- isConfig,
87
- isChecked
88
- ) => {
89
- const subUnit = dataStations[indexSubUnit];
90
- const device = subUnit.devices[indexEndDevice];
91
- const configs = item[`${isConfig ? 'read_configs' : 'actions'}`];
92
- const child = configs.find((i) => i.id === configId);
93
-
94
- child.isChecked = isChecked;
95
- device.isChecked =
96
- configs.length === configs.filter((i) => i.isChecked).length;
97
-
98
- subUnit.isChecked =
99
- subUnit.devices.length ===
100
- subUnit.devices.filter((i) => i.isChecked).length;
12
+ const t = useTranslations();
13
+ const [initialSelectedKeys, setInitialSelectedKeys] = useState([]);
14
+
15
+ const getInitialSelectedKeys = useCallback(
16
+ (sharedDevices) =>
17
+ sharedDevices.flatMap((subUnit) => [
18
+ `subUnit-${subUnit.id}`,
19
+ ...subUnit.devices.flatMap((device) => [
20
+ `device-${device.id}`,
21
+ ...device.actions.map((action) => `action-${action.id}`),
22
+ ...device.read_configs.map((config) => `config-${config.id}`),
23
+ ]),
24
+ ]),
25
+ []
26
+ );
101
27
 
102
- setIsTickAllDevices(!dataStations.some((i) => !i.isChecked));
103
- setDataStations(dataStations);
104
- setNeedRefresh(true);
105
- };
106
- const toggleExpandEndDevice = (deviceItem) => () => {
107
- setExpandedItemIds((ids) => {
108
- const index = ids.indexOf(deviceItem.id);
109
- if (index !== -1) {
110
- return [...ids.slice(0, index), ...ids.slice(index + 1)];
111
- } else {
112
- return [...ids, deviceItem.id];
28
+ useEffect(() => {
29
+ const getShareUnitPermission = async () => {
30
+ const { success, data } = await axiosGet(
31
+ API.SHARE.UNIT_MEMBER_SHARE_DEVICE_V2(unit.id, member.id)
32
+ );
33
+ if (success) {
34
+ const selectedKeys = getInitialSelectedKeys(data);
35
+ setInitialSelectedKeys(selectedKeys);
113
36
  }
114
- });
115
- };
116
-
117
- const expandEndDevice = (deviceItem) => () => {
118
- if (!expandedItemIds.includes(deviceItem.id)) {
119
- setExpandedItemIds((prev) => [...prev, deviceItem.id]);
120
- }
121
- };
122
-
123
- const autoCheckedGroup = (stations, dataDeviceShared) => {
124
- const { deviceIds, actionIds, configIds } = objectIds(dataDeviceShared);
125
- const updatedStations = stations.map((station) => ({
126
- ...station,
127
- isChecked: station.devices.every((device) =>
128
- deviceIds.includes(device.id)
129
- ),
130
- devices: station.devices.map((device) => ({
131
- ...device,
132
- isChecked: deviceIds.includes(device.id),
133
- actions: device.actions.map((action) => ({
134
- ...action,
135
- isChecked: actionIds.includes(action.id),
136
- })),
137
- read_configs: device.read_configs.map((config) => ({
138
- ...config,
139
- isChecked: configIds.includes(config.id),
140
- })),
141
- })),
142
- }));
143
- setDataStations(updatedStations);
144
- setIsTickAllDevices(
145
- updatedStations.length ===
146
- updatedStations.filter((i) => i.isChecked).length
147
- );
148
- };
149
-
150
- const GroupEndDevice = ({ item, indexSubUnit }) => {
151
- const { name, devices, isChecked } = item;
152
- return (
153
- <View style={styles.viewGroup}>
154
- <CheckBoxSubUnit
155
- title={name}
156
- onPress={onTickSubUnit}
157
- isChecked={isChecked}
158
- indexSubUnit={indexSubUnit}
159
- />
160
- <View style={styles.wrapDevice}>
161
- {devices.map((i, index) => (
162
- <EndDevice
163
- item={i}
164
- key={i.id}
165
- onTickedChild={onTickedChild}
166
- onTickEndDevice={onTickEndDevice}
167
- isItemExpanded={expandedItemIds.includes(i.id)}
168
- toggleExpandEndDevice={toggleExpandEndDevice(i)}
169
- expandEndDevice={expandEndDevice(i)}
170
- indexSubUnit={indexSubUnit}
171
- indexEndDevice={index}
172
- />
173
- ))}
174
- </View>
175
- </View>
176
- );
177
- };
178
-
179
- const onPressBottom = async () => {
180
- setLoading(true);
181
- let read_permissions = [];
182
- let control_permissions = [];
183
-
184
- for (const station of dataStations) {
185
- for (const end_device of station.devices) {
186
- const action_ids = end_device.actions
187
- .filter((action) => action.isChecked)
188
- .map((action) => action.id);
189
-
190
- const config_ids = end_device.read_configs
191
- .filter((config) => config.isChecked)
192
- .map((config) => config.id);
193
-
194
- if (action_ids.length > 0) {
195
- control_permissions.push({ id: end_device.id, values: action_ids });
196
- }
197
-
198
- if (config_ids.length > 0) {
199
- read_permissions.push({ id: end_device.id, values: config_ids });
200
- }
37
+ };
201
38
 
202
- if (
203
- action_ids.length === 0 &&
204
- config_ids.length === 0 &&
205
- end_device.isChecked
206
- ) {
207
- read_permissions.push({ id: end_device.id, values: [] });
208
- }
209
- }
210
- }
39
+ getShareUnitPermission();
40
+ }, [unit.id, member.id, getInitialSelectedKeys]);
211
41
 
212
- if (!read_permissions.length && !control_permissions.length) {
213
- setLoading(false);
214
- Alert.alert('', t('choose_at_least_one'));
215
- return;
216
- }
217
- let phone = '';
218
- let email = '';
219
- if (member.phone_number) {
220
- phone = member.phone_number;
221
- email = '';
222
- } else if (member.email) {
223
- phone = '';
224
- email = member.email;
225
- }
226
- const { success } = await axiosPost(API.SHARE.SHARE(), {
227
- phone,
228
- email,
42
+ const handleOnRightClick = async ({
43
+ read_permissions,
44
+ control_permissions,
45
+ }) => {
46
+ const { success } = await axiosPost(API.SHARE.SHARE_V2(), {
47
+ user_ids: [member.id],
229
48
  unit: unit.id,
230
49
  permissions: { read_permissions, control_permissions },
231
50
  is_remove_old_permission: true,
232
51
  });
233
- setLoading(false);
52
+
234
53
  success && navigation.goBack();
235
54
  };
236
55
 
237
- const renderSubUnit = ({ item, index }) => (
238
- <GroupEndDevice key={item.id} item={item} indexSubUnit={index} />
239
- );
240
-
241
- const renderFlatList = useMemo(() => {
242
- setNeedRefresh(false);
243
- return (
244
- <FlatList
245
- keyExtractor={(item) => item.id}
246
- extraData={dataStations}
247
- data={dataStations}
248
- renderItem={renderSubUnit}
249
- scrollIndicatorInsets={{ right: 1 }}
250
- ListHeaderComponent={
251
- <CheckBoxSubUnit
252
- title={t('text_all_devices')}
253
- onPress={onTickAllDevices}
254
- isChecked={isTickAllDevices}
255
- />
256
- }
257
- />
258
- );
259
- // eslint-disable-next-line react-hooks/exhaustive-deps
260
- }, [dataStations, isTickAllDevices, expandedItemIds, needRefresh]);
261
-
262
- const getShareUnitPermission = useCallback(
263
- async (stations) => {
264
- const { success, data } = await axiosGet(
265
- API.SHARE.UNIT_MEMBER_SHARE_DEVICE(unit.id, member.id)
266
- );
267
- if (success) {
268
- autoCheckedGroup(stations, data);
269
- }
270
- },
271
- [member.id, unit.id]
272
- );
273
-
274
- const getUnitPermission = useCallback(async () => {
275
- const { success, data } = await axiosGet(
276
- API.SHARE.UNIT_PERMISSIONS(unit.id)
277
- );
278
- if (success) {
279
- setDataStations(data);
280
- await getShareUnitPermission(data);
281
- }
282
- setLoading(false);
283
- }, [getShareUnitPermission, unit.id]);
284
-
285
- useEffect(() => {
286
- getUnitPermission();
287
- }, [getUnitPermission]);
288
-
289
56
  return (
290
- <View style={styles.wrap}>
291
- <Text semibold style={styles.title}>
292
- {t('select_device')}
293
- </Text>
294
- <Text style={styles.subtitle}>{t('sharing_select_devices_hint')}</Text>
295
- <View style={styles.contentContainer}>
296
- {loading ? (
297
- <ActivityIndicator color={Colors.Primary} />
298
- ) : dataStations.length > 0 ? (
299
- renderFlatList
300
- ) : (
301
- <Text
302
- style={styles.textNodata}
303
- accessibilityLabel={AccessibilityLabel.TEXT_NO_DATA_STATIONS}
304
- >
305
- {t('no_data')}
306
- </Text>
307
- )}
308
- </View>
309
- <View style={styles.wrapViewButtonStyle}>
310
- <ViewButtonBottom
311
- leftTitle={t('cancel')}
312
- onLeftClick={() => navigation.goBack()}
313
- rightTitle={t('done')}
314
- rightDisabled={false}
315
- onRightClick={onPressBottom}
316
- />
317
- </View>
318
- </View>
57
+ <ShareDeviceSelector
58
+ unitId={unit.id}
59
+ onRightClick={handleOnRightClick}
60
+ rightTitle={t('done')}
61
+ initialSelectedKeys={initialSelectedKeys}
62
+ />
319
63
  );
320
64
  };
321
65
 
322
- export default memo(UpdateShareDevice);
66
+ export default UpdateShareDevice;
@@ -1,21 +1,21 @@
1
- import React from 'react';
2
- import { create, act } from 'react-test-renderer';
3
- import { TouchableOpacity } from 'react-native';
4
- import MockAdapter from 'axios-mock-adapter';
5
-
6
- import InfoMemberUnit from '../InfoMemberUnit';
7
- import { HeaderCustom } from '../../../commons/Header';
8
- import { SCProvider } from '../../../context';
9
- import { mockSCStore } from '../../../context/mockStore';
10
1
  import { AlertAction, ViewButtonBottom } from '../../../commons';
2
+ import { act, create } from 'react-test-renderer';
3
+
11
4
  import API from '../../../configs/API';
12
5
  import { AccessibilityLabel } from '../../../configs/Constants';
13
- import api from '../../../utils/Apis/axios';
6
+ import { HeaderCustom } from '../../../commons/Header';
7
+ import InfoMemberUnit from '../InfoMemberUnit';
14
8
  import ItemChangeRole from '../Components/ItemChangeRole';
9
+ import MockAdapter from 'axios-mock-adapter';
15
10
  import ModalPopupCT from '../../../commons/ModalPopupCT';
11
+ import React from 'react';
16
12
  import Routes from '../../../utils/Route';
17
- import { useNavigation } from '@react-navigation/native';
18
13
  import RowGuestInfo from '../../GuestInfo/components/RowGuestInfo';
14
+ import { SCProvider } from '../../../context';
15
+ import { TouchableOpacity } from 'react-native';
16
+ import api from '../../../utils/Apis/axios';
17
+ import { mockSCStore } from '../../../context/mockStore';
18
+ import { useNavigation } from '@react-navigation/native';
19
19
 
20
20
  const mock = new MockAdapter(api.axiosInstance);
21
21
 
@@ -212,4 +212,51 @@ describe('Test InfoMemberUnit', () => {
212
212
  });
213
213
  expect(global.mockedNavigate).toHaveBeenCalledTimes(1);
214
214
  });
215
+
216
+ it('test click left button', async () => {
217
+ jest.useFakeTimers();
218
+ mock.onGet(API.SHARE.UNIT_MEMBER_INFO(1, 1)).reply(200, {
219
+ id: 2,
220
+ identity: 'member',
221
+ name: 'user',
222
+ email: 'abc@gmail.com',
223
+ avatar: 'abc.png',
224
+ });
225
+ await act(async () => {
226
+ tree = await create(wrapComponent(route));
227
+ });
228
+ const instance = tree.root;
229
+ const touchChangeRole = instance.findByProps({
230
+ accessibilityLabel: AccessibilityLabel.CHANGE_ROLE,
231
+ });
232
+ await act(async () => {
233
+ await touchChangeRole.props.onPress();
234
+ });
235
+
236
+ const alertAction = instance.findByType(AlertAction);
237
+ expect(alertAction.props.visible).toEqual(true);
238
+
239
+ const itemChangeRole = instance.findAllByType(ItemChangeRole);
240
+ expect(itemChangeRole).toHaveLength(2);
241
+
242
+ await act(async () => {
243
+ await itemChangeRole[0].props.onPress();
244
+ });
245
+ await act(async () => {
246
+ await alertAction.props.rightButtonClick();
247
+ });
248
+
249
+ await act(async () => {
250
+ jest.runAllTimers();
251
+ });
252
+
253
+ const viewButtonBottom = instance.findAllByType(ViewButtonBottom);
254
+ expect(viewButtonBottom).toHaveLength(2);
255
+
256
+ await act(async () => {
257
+ await viewButtonBottom[1].props.onLeftClick();
258
+ });
259
+ const modalPopupCT = instance.findByType(ModalPopupCT);
260
+ expect(modalPopupCT.props.isVisible).toEqual(false);
261
+ });
215
262
  });