@eohjsc/react-native-smart-city 0.4.46 → 0.4.47
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eohjsc/react-native-smart-city",
|
|
3
3
|
"title": "React Native Smart Home",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.47",
|
|
5
5
|
"description": "TODO",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"pluralize": "^8.0.0",
|
|
148
148
|
"postinstall": "^0.7.0",
|
|
149
149
|
"precompiled-mqtt": "^4.3.14-beta",
|
|
150
|
-
"pusher-js": "^
|
|
150
|
+
"pusher-js": "^8.0.2",
|
|
151
151
|
"pusher-js-auth": "^4.0.1",
|
|
152
152
|
"python-struct": "^1.1.3",
|
|
153
153
|
"querystring": "^0.2.0",
|
|
@@ -698,18 +698,17 @@ describe('test DeviceDetail', () => {
|
|
|
698
698
|
items: [
|
|
699
699
|
{
|
|
700
700
|
configuration: {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
is_on_value: [],
|
|
701
|
+
config: 131357,
|
|
702
|
+
config_data: {
|
|
703
|
+
sensor_id: 36700,
|
|
704
|
+
chip_id: 8296,
|
|
706
705
|
},
|
|
707
706
|
title: 'Turn on / off',
|
|
708
707
|
},
|
|
709
708
|
id: 18,
|
|
710
709
|
order: 2,
|
|
711
|
-
template: '
|
|
712
|
-
type: '
|
|
710
|
+
template: 'OnOffSimpleActionTemplate',
|
|
711
|
+
type: 'OnOffSimpleActionTemplate',
|
|
713
712
|
},
|
|
714
713
|
],
|
|
715
714
|
};
|
|
@@ -330,9 +330,7 @@ const DeviceDetail = ({ route }) => {
|
|
|
330
330
|
|
|
331
331
|
const listMenuItem = useMemo(() => {
|
|
332
332
|
const menuItems = [];
|
|
333
|
-
if (
|
|
334
|
-
display.items.some((i) => getActionComponent(i.configuration.template))
|
|
335
|
-
) {
|
|
333
|
+
if (display.items.some((i) => getActionComponent(i.template))) {
|
|
336
334
|
menuItems.push({
|
|
337
335
|
route: Routes.ActivityLog,
|
|
338
336
|
data: {
|
|
@@ -10,10 +10,13 @@ import Text from '../../../commons/Text';
|
|
|
10
10
|
import { useRoute } from '@react-navigation/native';
|
|
11
11
|
import { getTranslate } from '../../../utils/I18n';
|
|
12
12
|
import { TouchableOpacity } from 'react-native';
|
|
13
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
13
14
|
|
|
14
15
|
const wrapComponent = () => (
|
|
15
16
|
<SCProvider initState={mockSCStore({})}>
|
|
16
|
-
<
|
|
17
|
+
<GestureHandlerRootView>
|
|
18
|
+
<EditTemplate />
|
|
19
|
+
</GestureHandlerRootView>
|
|
17
20
|
</SCProvider>
|
|
18
21
|
);
|
|
19
22
|
|
|
@@ -44,55 +47,55 @@ describe('Test EditTemplate', () => {
|
|
|
44
47
|
];
|
|
45
48
|
|
|
46
49
|
it('Test render empty', async () => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
useRoute.mockReturnValue({
|
|
51
|
+
params: {},
|
|
52
|
+
});
|
|
53
|
+
await act(async () => {
|
|
54
|
+
tree = await create(wrapComponent());
|
|
55
|
+
});
|
|
56
|
+
const instance = tree.root;
|
|
57
|
+
const Texts = instance.findAllByType(Text);
|
|
58
|
+
expect(Texts[0].props.children).toBe(getTranslate('en', 'no_widgets'));
|
|
59
|
+
expect(Texts[1].props.children).toBe(getTranslate('en', 'add_your_widget'));
|
|
57
60
|
});
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
it('Test render list widgets', async () => {
|
|
63
|
+
useRoute.mockReturnValue({
|
|
64
|
+
params: {
|
|
65
|
+
data,
|
|
66
|
+
setData: mockSetData,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
await act(async () => {
|
|
70
|
+
tree = await create(wrapComponent());
|
|
71
|
+
});
|
|
72
|
+
const instance = tree.root;
|
|
73
|
+
const DraggableFlatLists = instance.findAllByType(DraggableFlatList);
|
|
74
|
+
expect(DraggableFlatLists).toHaveLength(1);
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
const TouchableOpacities = instance.findAllByType(TouchableOpacity);
|
|
74
77
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
await act(async () => {
|
|
79
|
+
await TouchableOpacities[0].props.onPress();
|
|
80
|
+
});
|
|
81
|
+
await act(async () => {
|
|
82
|
+
const firstItem = instance.findByProps({ accessibilityLabel: 'item-0' });
|
|
83
|
+
await firstItem.props.onLongPress();
|
|
84
|
+
});
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
expect(mockGoBack).toBeCalled();
|
|
84
87
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
88
|
+
mockGoBack.mockReset();
|
|
89
|
+
await act(async () => {
|
|
90
|
+
await DraggableFlatLists[0].props.onDragEnd({
|
|
91
|
+
data,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
await act(async () => {
|
|
95
|
+
await instance
|
|
96
|
+
.findByProps({ accessibilityLabel: 'Save' })
|
|
97
|
+
.props.onPress();
|
|
98
|
+
});
|
|
99
|
+
expect(mockGoBack).toBeCalled();
|
|
100
|
+
});
|
|
98
101
|
});
|