@eohjsc/react-native-smart-city 0.2.72 → 0.2.76
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/index.js +2 -1
- package/package.json +2 -2
- package/src/Images/Common/disney.svg +20 -0
- package/src/Images/Common/home.svg +3 -0
- package/src/Images/Common/input.svg +3 -0
- package/src/Images/Common/keyboard_arrow_down.svg +3 -0
- package/src/Images/Common/keyboard_arrow_up.svg +3 -0
- package/src/Images/Common/keyboard_return.svg +3 -0
- package/src/Images/Common/netflix.svg +9 -0
- package/src/Images/Common/pause.svg +3 -0
- package/src/Images/Common/shadowButton.png +0 -0
- package/src/Images/Common/spotify.svg +5 -0
- package/src/Images/Common/volume_up.svg +3 -0
- package/src/Images/Common/youtube.svg +13 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplate.js +214 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/SmartTiviActionTemplateStyles.js +69 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/CircleButton.test.js +129 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/ControlPlay.test.js +138 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/RectangleButton.test.js +110 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js +144 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButton.js +91 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/CircleButtonStyles.js +79 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlay.js +51 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/ControlPlayStyles.js +24 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/Icon.js +25 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButton.js +49 -0
- package/src/commons/ActionGroup/SmartTiviActionTemplate/component/RectangleButtonStyles.js +47 -0
- package/src/commons/ActionGroup/__test__/TimerActionTemplate.test.js +1 -1
- package/src/commons/ActionGroup/__test__/TimerActionTemplateWithutConfigValue.test.js +1 -1
- package/src/commons/ActionGroup/__test__/index.test.js +3 -3
- package/src/commons/ActionGroup/index.js +3 -0
- package/src/commons/ActionTemplate/__test__/index.test.js +2 -2
- package/src/commons/Automate/__test__/ItemAutomate.test.js +1 -1
- package/src/commons/Dashboard/MyPinnedSharedUnit/__test__/MyPinnedSharedUnit.test.js +1 -1
- package/src/commons/Device/HistoryChart.js +11 -7
- package/src/commons/Device/HorizontalBarChart.js +2 -1
- package/src/commons/Device/ItemDevice.js +17 -2
- package/src/commons/Device/WaterQualitySensor/QualityIndicatorsItem.js +1 -1
- package/src/commons/Device/WindDirection/Compass/Compass.test.js +2 -2
- package/src/commons/Device/__test__/ConnectedViewHeader.test.js +2 -2
- package/src/commons/Device/__test__/DisconnectedView.test.js +5 -5
- package/src/commons/Explore/__test__/HeaderExplore.test.js +1 -1
- package/src/commons/MediaPlayerDetail/__test__/MediaPlayerDetail.test.js +1 -1
- package/src/commons/Modal/__test__/ModalBottom.test.js +2 -2
- package/src/commons/Sharing/__test__/MemberList.test.js +3 -3
- package/src/commons/Sharing/__test__/RowMember.test.js +2 -2
- package/src/commons/SubUnit/Favorites/index.js +32 -1
- package/src/commons/SubUnit/ShortDetail.js +33 -3
- package/src/commons/SubUnit/__test__/Favorites.test.js +1 -0
- package/src/commons/SubUnit/__test__/ShortDetail.test.js +1 -0
- package/src/commons/Today/__test__/Today.test.js +1 -1
- package/src/configs/API.js +4 -0
- package/src/configs/Constants.js +23 -0
- package/src/configs/Images.js +1 -0
- package/src/context/SCContext.tsx +35 -2
- package/src/context/index.ts +6 -1
- package/src/navigations/UnitStack.js +1 -3
- package/src/screens/ActivityLog/__test__/index.test.js +10 -11
- package/src/screens/AddNewAction/Device/__test__/index.test.js +2 -2
- package/src/screens/AddNewDevice/__test__/ConnectingDevices.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/ConnectWifiWarning.js +37 -50
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/FirstWarning.test.js +1 -1
- package/src/screens/AddNewGateway/PlugAndPlay/__test__/GatewayWifiList.test.js +1 -1
- package/src/screens/AddNewGateway/__test__/ConnectingGateway.test.js +1 -1
- package/src/screens/AddNewGateway/index.js +5 -1
- package/src/screens/ConfirmUnitDeletion/index.js +1 -1
- package/src/screens/Device/EditDevice/index.js +1 -1
- package/src/screens/Device/EditDevice/styles/EditDeviceStyles.js +2 -0
- package/src/screens/Notification/Monitor.js +12 -0
- package/src/screens/Notification/components/NotificationItem.js +11 -0
- package/src/screens/Notification/index.js +8 -0
- package/src/screens/PlayBackCamera/__test__/index.test.js +1 -1
- package/src/screens/Unit/Detail.js +2 -2
- package/src/screens/Unit/ManageUnit.js +9 -6
- package/src/screens/Unit/__test__/Detail.test.js +7 -1
- package/src/screens/Unit/components/MyUnitDevice/index.js +4 -1
- package/src/screens/Unit/components/__test__/Header.test.js +5 -5
- package/src/screens/Unit/components/__test__/MyUnitDevice.test.js +2 -2
- package/src/screens/UnitSummary/components/PowerConsumption/index.js +4 -2
- package/src/utils/I18n/translations/en.json +3 -1
- package/src/utils/I18n/translations/vi.json +3 -1
- package/src/utils/Pusher/index.js +36 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import ControlPlay from '../component/ControlPlay';
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
7
|
+
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
|
|
9
|
+
const wrapComponent = (onPressPrev, onPressStop, onPressNext) => (
|
|
10
|
+
<SCProvider initState={mockSCStore({})}>
|
|
11
|
+
<ControlPlay
|
|
12
|
+
onPressPrev={onPressPrev}
|
|
13
|
+
onPressStop={onPressStop}
|
|
14
|
+
onPressNext={onPressNext}
|
|
15
|
+
/>
|
|
16
|
+
</SCProvider>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
describe('Test ControlPlay', () => {
|
|
20
|
+
let wrapper;
|
|
21
|
+
test('render ControlPlay', async () => {
|
|
22
|
+
const mockOnPress = jest.fn();
|
|
23
|
+
await act(async () => {
|
|
24
|
+
wrapper = await create(
|
|
25
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
const instance = wrapper.root;
|
|
29
|
+
|
|
30
|
+
const prevButton = instance.findAllByType(TouchableOpacity);
|
|
31
|
+
expect(prevButton).toHaveLength(3);
|
|
32
|
+
});
|
|
33
|
+
test('render ControlPlay Prev', async () => {
|
|
34
|
+
const mockOnPress = jest.fn();
|
|
35
|
+
await act(async () => {
|
|
36
|
+
wrapper = await create(
|
|
37
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
const instance = wrapper.root;
|
|
41
|
+
|
|
42
|
+
const PrevButton = instance.find(
|
|
43
|
+
(el) =>
|
|
44
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.PREV_BUTTON &&
|
|
45
|
+
el.type === TouchableOpacity
|
|
46
|
+
);
|
|
47
|
+
expect(PrevButton).toBeDefined();
|
|
48
|
+
});
|
|
49
|
+
test('OnPress ControlPlay Prev', async () => {
|
|
50
|
+
const mockOnPress = jest.fn();
|
|
51
|
+
await act(async () => {
|
|
52
|
+
wrapper = await create(
|
|
53
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
const instance = wrapper.root;
|
|
57
|
+
|
|
58
|
+
const PrevButton = instance.find(
|
|
59
|
+
(el) =>
|
|
60
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.PREV_BUTTON &&
|
|
61
|
+
el.type === TouchableOpacity
|
|
62
|
+
);
|
|
63
|
+
expect(PrevButton).toBeDefined();
|
|
64
|
+
act(() => {
|
|
65
|
+
PrevButton.props.onPress();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
test('render ControlPlay Stop', async () => {
|
|
69
|
+
const mockOnPress = jest.fn();
|
|
70
|
+
await act(async () => {
|
|
71
|
+
wrapper = await create(
|
|
72
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
const instance = wrapper.root;
|
|
76
|
+
|
|
77
|
+
const StopButton = instance.find(
|
|
78
|
+
(el) =>
|
|
79
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.STOP_BUTTON &&
|
|
80
|
+
el.type === TouchableOpacity
|
|
81
|
+
);
|
|
82
|
+
expect(StopButton).toBeDefined();
|
|
83
|
+
});
|
|
84
|
+
test('OnPress ControlPlay Stop', async () => {
|
|
85
|
+
const mockOnPress = jest.fn();
|
|
86
|
+
await act(async () => {
|
|
87
|
+
wrapper = await create(
|
|
88
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
const instance = wrapper.root;
|
|
92
|
+
|
|
93
|
+
const StopButton = instance.find(
|
|
94
|
+
(el) =>
|
|
95
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.STOP_BUTTON &&
|
|
96
|
+
el.type === TouchableOpacity
|
|
97
|
+
);
|
|
98
|
+
expect(StopButton).toBeDefined();
|
|
99
|
+
act(() => {
|
|
100
|
+
StopButton.props.onPress();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
test('render ControlPlay Next', async () => {
|
|
104
|
+
const mockOnPress = jest.fn();
|
|
105
|
+
await act(async () => {
|
|
106
|
+
wrapper = await create(
|
|
107
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
const instance = wrapper.root;
|
|
111
|
+
|
|
112
|
+
const NextButton = instance.find(
|
|
113
|
+
(el) =>
|
|
114
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.NEXT_BUTTON &&
|
|
115
|
+
el.type === TouchableOpacity
|
|
116
|
+
);
|
|
117
|
+
expect(NextButton).toBeDefined();
|
|
118
|
+
});
|
|
119
|
+
test('OnPress ControlPlay Next', async () => {
|
|
120
|
+
const mockOnPress = jest.fn();
|
|
121
|
+
await act(async () => {
|
|
122
|
+
wrapper = await create(
|
|
123
|
+
wrapComponent(mockOnPress, mockOnPress, mockOnPress)
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
const instance = wrapper.root;
|
|
127
|
+
|
|
128
|
+
const NextButton = instance.find(
|
|
129
|
+
(el) =>
|
|
130
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.NEXT_BUTTON &&
|
|
131
|
+
el.type === TouchableOpacity
|
|
132
|
+
);
|
|
133
|
+
expect(NextButton).toBeDefined();
|
|
134
|
+
act(() => {
|
|
135
|
+
NextButton.props.onPress();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import RectangleButton from '../component/RectangleButton';
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
+
import { TouchableOpacity } from 'react-native';
|
|
7
|
+
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
|
|
9
|
+
const wrapComponent = (type, onPress, onPressUp, onPressDown, icon) => (
|
|
10
|
+
<SCProvider initState={mockSCStore({})}>
|
|
11
|
+
<RectangleButton
|
|
12
|
+
type={type}
|
|
13
|
+
icon={icon}
|
|
14
|
+
onPress={onPress}
|
|
15
|
+
onPressUp={onPressUp}
|
|
16
|
+
onPressDown={onPressDown}
|
|
17
|
+
/>
|
|
18
|
+
</SCProvider>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
describe('Test RectangleButton', () => {
|
|
22
|
+
let wrapper;
|
|
23
|
+
let type;
|
|
24
|
+
test('render all RectangleButton column', async () => {
|
|
25
|
+
type = 'column';
|
|
26
|
+
const mockOnPress = jest.fn();
|
|
27
|
+
await act(async () => {
|
|
28
|
+
wrapper = await create(
|
|
29
|
+
wrapComponent(type, mockOnPress, mockOnPress, mockOnPress)
|
|
30
|
+
);
|
|
31
|
+
});
|
|
32
|
+
const instance = wrapper.root;
|
|
33
|
+
const touchableOpacity = instance.findAllByType(TouchableOpacity);
|
|
34
|
+
expect(touchableOpacity).toHaveLength(2);
|
|
35
|
+
});
|
|
36
|
+
test('render RectangleButtonUp column', async () => {
|
|
37
|
+
type = 'column';
|
|
38
|
+
const mockOnPress = jest.fn();
|
|
39
|
+
await act(async () => {
|
|
40
|
+
wrapper = await create(
|
|
41
|
+
wrapComponent(type, mockOnPress, mockOnPress, mockOnPress)
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
const instance = wrapper.root;
|
|
45
|
+
|
|
46
|
+
const RectangleButtonUp = instance.find(
|
|
47
|
+
(el) =>
|
|
48
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CH_VOLUME_UP_BUTTON &&
|
|
49
|
+
el.type === TouchableOpacity
|
|
50
|
+
);
|
|
51
|
+
expect(RectangleButtonUp).toBeDefined();
|
|
52
|
+
});
|
|
53
|
+
test('onPress RectangleButtonUp column', async () => {
|
|
54
|
+
type = 'column';
|
|
55
|
+
const mockOnPress = jest.fn();
|
|
56
|
+
await act(async () => {
|
|
57
|
+
wrapper = await create(
|
|
58
|
+
wrapComponent(type, mockOnPress, mockOnPress, mockOnPress)
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
const instance = wrapper.root;
|
|
62
|
+
|
|
63
|
+
const RectangleButtonUp = instance.find(
|
|
64
|
+
(el) =>
|
|
65
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CH_VOLUME_UP_BUTTON &&
|
|
66
|
+
el.type === TouchableOpacity
|
|
67
|
+
);
|
|
68
|
+
expect(RectangleButtonUp).toBeDefined();
|
|
69
|
+
act(() => {
|
|
70
|
+
RectangleButtonUp.props.onPress();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
test('render RectangleButtonDown column', async () => {
|
|
74
|
+
type = 'column';
|
|
75
|
+
const mockOnPress = jest.fn();
|
|
76
|
+
await act(async () => {
|
|
77
|
+
wrapper = await create(
|
|
78
|
+
wrapComponent(type, mockOnPress, mockOnPress, mockOnPress)
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
const instance = wrapper.root;
|
|
82
|
+
|
|
83
|
+
const RectangleButtonDown = instance.find(
|
|
84
|
+
(el) =>
|
|
85
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CH_VOLUME_DOWN_BUTTON &&
|
|
86
|
+
el.type === TouchableOpacity
|
|
87
|
+
);
|
|
88
|
+
expect(RectangleButtonDown).toBeDefined();
|
|
89
|
+
});
|
|
90
|
+
test('onPress RectangleButtonDown column', async () => {
|
|
91
|
+
type = 'column';
|
|
92
|
+
const mockOnPress = jest.fn();
|
|
93
|
+
await act(async () => {
|
|
94
|
+
wrapper = await create(
|
|
95
|
+
wrapComponent(type, mockOnPress, mockOnPress, mockOnPress)
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
const instance = wrapper.root;
|
|
99
|
+
|
|
100
|
+
const RectangleButtonDown = instance.find(
|
|
101
|
+
(el) =>
|
|
102
|
+
el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CH_VOLUME_DOWN_BUTTON &&
|
|
103
|
+
el.type === TouchableOpacity
|
|
104
|
+
);
|
|
105
|
+
expect(RectangleButtonDown).toBeDefined();
|
|
106
|
+
act(() => {
|
|
107
|
+
RectangleButtonDown.props.onPress();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
});
|
package/src/commons/ActionGroup/SmartTiviActionTemplate/__test__/SmartTiviActionTemplate.test.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, create } from 'react-test-renderer';
|
|
3
|
+
import SmartTiviActionTemplate from '../SmartTiviActionTemplate';
|
|
4
|
+
import { SCProvider } from '../../../../context';
|
|
5
|
+
import { mockSCStore } from '../../../../context/mockStore';
|
|
6
|
+
import { ScrollView } from 'react-native';
|
|
7
|
+
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
|
|
9
|
+
const wrapComponent = (actionGroup, doAction) => (
|
|
10
|
+
<SCProvider initState={mockSCStore({})}>
|
|
11
|
+
<SmartTiviActionTemplate actionGroup={actionGroup} doAction={doAction} />
|
|
12
|
+
</SCProvider>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
describe('Test SmartTiviActionTemplate', () => {
|
|
16
|
+
let wrapper;
|
|
17
|
+
test('render SmartTiviActionTemplate', async () => {
|
|
18
|
+
await act(async () => {
|
|
19
|
+
wrapper = await create(wrapComponent());
|
|
20
|
+
});
|
|
21
|
+
const instance = wrapper.root;
|
|
22
|
+
const touchableOpacity = instance.findAllByType(ScrollView);
|
|
23
|
+
expect(touchableOpacity).toHaveLength(1);
|
|
24
|
+
});
|
|
25
|
+
test('render CircleButton small OnOff and exit', async () => {
|
|
26
|
+
await act(async () => {
|
|
27
|
+
wrapper = await create(wrapComponent());
|
|
28
|
+
});
|
|
29
|
+
const instance = wrapper.root;
|
|
30
|
+
const circleButtonOnOff = instance.find(
|
|
31
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.ONOFF_BUTTON
|
|
32
|
+
);
|
|
33
|
+
expect(circleButtonOnOff).toBeDefined();
|
|
34
|
+
await act(() => {
|
|
35
|
+
circleButtonOnOff.props.onPress();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const circleButtonExit = instance.find(
|
|
39
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.EXIT_BUTTON
|
|
40
|
+
);
|
|
41
|
+
expect(circleButtonExit).toBeDefined();
|
|
42
|
+
// expect(circleButton).toHaveLength(2);
|
|
43
|
+
|
|
44
|
+
await act(() => {
|
|
45
|
+
circleButtonExit.props.onPress();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
test('render RectangleButton column Volume and CH', async () => {
|
|
49
|
+
await act(async () => {
|
|
50
|
+
wrapper = await create(wrapComponent());
|
|
51
|
+
});
|
|
52
|
+
const instance = wrapper.root;
|
|
53
|
+
const RectangleButtonVolume = instance.find(
|
|
54
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.VOLUME_BUTTON
|
|
55
|
+
);
|
|
56
|
+
expect(RectangleButtonVolume).toBeDefined();
|
|
57
|
+
await act(() => {
|
|
58
|
+
RectangleButtonVolume.props.onPressUp();
|
|
59
|
+
});
|
|
60
|
+
await act(() => {
|
|
61
|
+
RectangleButtonVolume.props.onPressDown();
|
|
62
|
+
});
|
|
63
|
+
const RectangleButtonCH = instance.find(
|
|
64
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CH_BUTTON
|
|
65
|
+
);
|
|
66
|
+
expect(RectangleButtonCH).toBeDefined();
|
|
67
|
+
await act(() => {
|
|
68
|
+
RectangleButtonCH.props.onPressUp();
|
|
69
|
+
});
|
|
70
|
+
await act(() => {
|
|
71
|
+
RectangleButtonCH.props.onPressDown();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
test('render CircleButton big button', async () => {
|
|
75
|
+
await act(async () => {
|
|
76
|
+
wrapper = await create(wrapComponent());
|
|
77
|
+
});
|
|
78
|
+
const instance = wrapper.root;
|
|
79
|
+
const CircleButtonBig = instance.find(
|
|
80
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.BIG_BUTTON
|
|
81
|
+
);
|
|
82
|
+
expect(CircleButtonBig).toBeDefined();
|
|
83
|
+
await act(() => {
|
|
84
|
+
CircleButtonBig.props.onPressUp();
|
|
85
|
+
});
|
|
86
|
+
await act(() => {
|
|
87
|
+
CircleButtonBig.props.onPressDown();
|
|
88
|
+
});
|
|
89
|
+
await act(() => {
|
|
90
|
+
CircleButtonBig.props.onPressLeft();
|
|
91
|
+
});
|
|
92
|
+
await act(() => {
|
|
93
|
+
CircleButtonBig.props.onPressRight();
|
|
94
|
+
});
|
|
95
|
+
await act(() => {
|
|
96
|
+
CircleButtonBig.props.onPressOk();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
test('render ControlPlay button', async () => {
|
|
100
|
+
await act(async () => {
|
|
101
|
+
wrapper = await create(wrapComponent());
|
|
102
|
+
});
|
|
103
|
+
const instance = wrapper.root;
|
|
104
|
+
const ControlPlay = instance.find(
|
|
105
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.CONTROL_BUTTON
|
|
106
|
+
);
|
|
107
|
+
expect(ControlPlay).toBeDefined();
|
|
108
|
+
await act(() => {
|
|
109
|
+
ControlPlay.props.onPressPrev();
|
|
110
|
+
});
|
|
111
|
+
await act(() => {
|
|
112
|
+
ControlPlay.props.onPressStop();
|
|
113
|
+
});
|
|
114
|
+
await act(() => {
|
|
115
|
+
ControlPlay.props.onPressNext();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
test('render controlHome button', async () => {
|
|
119
|
+
await act(async () => {
|
|
120
|
+
wrapper = await create(wrapComponent());
|
|
121
|
+
});
|
|
122
|
+
const instance = wrapper.root;
|
|
123
|
+
const controlHome = instance.find(
|
|
124
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.HOME_BUTTON
|
|
125
|
+
);
|
|
126
|
+
expect(controlHome).toBeDefined();
|
|
127
|
+
await act(() => {
|
|
128
|
+
controlHome.props.onPress();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
test('render controlBack button', async () => {
|
|
132
|
+
await act(async () => {
|
|
133
|
+
wrapper = await create(wrapComponent());
|
|
134
|
+
});
|
|
135
|
+
const instance = wrapper.root;
|
|
136
|
+
const controlBack = instance.find(
|
|
137
|
+
(el) => el.props.testID === TESTID.SMART_TIVI_TEMPLATE.BACK_BUTTON
|
|
138
|
+
);
|
|
139
|
+
expect(controlBack).toBeDefined();
|
|
140
|
+
await act(() => {
|
|
141
|
+
controlBack.props.onPress();
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { TouchableOpacity, View, Image } from 'react-native';
|
|
3
|
+
import styles from './CircleButtonStyles';
|
|
4
|
+
import Text from '../../../Text';
|
|
5
|
+
import { Colors, Images } from '../../../../configs';
|
|
6
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
7
|
+
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
|
|
9
|
+
const CircleButton = memo(
|
|
10
|
+
({
|
|
11
|
+
icon,
|
|
12
|
+
onPress,
|
|
13
|
+
wrapStyle,
|
|
14
|
+
type,
|
|
15
|
+
onPressUp,
|
|
16
|
+
onPressDown,
|
|
17
|
+
onPressLeft,
|
|
18
|
+
onPressRight,
|
|
19
|
+
onPressOk,
|
|
20
|
+
}) => {
|
|
21
|
+
switch (type) {
|
|
22
|
+
case 'small':
|
|
23
|
+
return (
|
|
24
|
+
<TouchableOpacity
|
|
25
|
+
style={[styles.circleSmallButton, wrapStyle]}
|
|
26
|
+
onPress={onPress}
|
|
27
|
+
>
|
|
28
|
+
<View style={styles.backgroundButton}>
|
|
29
|
+
{!!icon && icon}
|
|
30
|
+
<Image
|
|
31
|
+
source={Images.shadowButton}
|
|
32
|
+
resizeMode={'contain'}
|
|
33
|
+
style={styles.positionAbsolute}
|
|
34
|
+
/>
|
|
35
|
+
</View>
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
);
|
|
38
|
+
case 'big':
|
|
39
|
+
return (
|
|
40
|
+
<View style={styles.multipleButton}>
|
|
41
|
+
<View style={styles.headerMultipleButton}>
|
|
42
|
+
<TouchableOpacity
|
|
43
|
+
style={[styles.upButton, styles.padding16]}
|
|
44
|
+
onPress={onPressUp}
|
|
45
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.UP_BUTTON}
|
|
46
|
+
>
|
|
47
|
+
<IconOutline size={14} name={'caret-up'} />
|
|
48
|
+
</TouchableOpacity>
|
|
49
|
+
</View>
|
|
50
|
+
<View style={styles.bodyMultipleButton}>
|
|
51
|
+
<TouchableOpacity
|
|
52
|
+
style={[styles.leftButton, styles.padding16]}
|
|
53
|
+
onPress={onPressLeft}
|
|
54
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.LEFT_BUTTON}
|
|
55
|
+
>
|
|
56
|
+
<IconOutline size={14} name={'caret-left'} />
|
|
57
|
+
</TouchableOpacity>
|
|
58
|
+
<TouchableOpacity
|
|
59
|
+
style={[styles.okButton]}
|
|
60
|
+
onPress={onPressOk}
|
|
61
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.OK_BUTTON}
|
|
62
|
+
>
|
|
63
|
+
<Text type="H4" color={Colors.Gray9} bold>
|
|
64
|
+
OK
|
|
65
|
+
</Text>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
<TouchableOpacity
|
|
68
|
+
style={[styles.rightButton, styles.padding16]}
|
|
69
|
+
onPress={onPressRight}
|
|
70
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.RIGHT_BUTTON}
|
|
71
|
+
>
|
|
72
|
+
<IconOutline size={14} name={'caret-right'} />
|
|
73
|
+
</TouchableOpacity>
|
|
74
|
+
</View>
|
|
75
|
+
<View style={styles.footerMultipleButton}>
|
|
76
|
+
<TouchableOpacity
|
|
77
|
+
style={[styles.downButton, styles.padding16]}
|
|
78
|
+
onPress={onPressDown}
|
|
79
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.DOWN_BUTTON}
|
|
80
|
+
>
|
|
81
|
+
<IconOutline size={14} name={'caret-down'} />
|
|
82
|
+
</TouchableOpacity>
|
|
83
|
+
</View>
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
default:
|
|
87
|
+
return <></>;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
export default CircleButton;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Colors, Device } from '../../../../configs';
|
|
3
|
+
|
|
4
|
+
const centerRowItem = {
|
|
5
|
+
justifyContent: 'center',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
};
|
|
8
|
+
const betweenRowItem = {
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
justifyContent: 'space-between',
|
|
11
|
+
};
|
|
12
|
+
const widthMonitor = Device.screenWidth;
|
|
13
|
+
export default StyleSheet.create({
|
|
14
|
+
wrap: {
|
|
15
|
+
flex: 1,
|
|
16
|
+
paddingHorizontal: 16,
|
|
17
|
+
},
|
|
18
|
+
circleSmallButton: {
|
|
19
|
+
...centerRowItem,
|
|
20
|
+
width: 56,
|
|
21
|
+
height: 56,
|
|
22
|
+
},
|
|
23
|
+
backgroundButton: {
|
|
24
|
+
flex: 1,
|
|
25
|
+
...centerRowItem,
|
|
26
|
+
},
|
|
27
|
+
positionAbsolute: {
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
zIndex: 1,
|
|
30
|
+
},
|
|
31
|
+
multipleButton: {
|
|
32
|
+
flexWrap: 'nowrap',
|
|
33
|
+
width: widthMonitor - 206.5,
|
|
34
|
+
height: 186,
|
|
35
|
+
borderRadius: 900,
|
|
36
|
+
borderColor: Colors.Gray4,
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
},
|
|
39
|
+
padding16: {
|
|
40
|
+
padding: 16,
|
|
41
|
+
},
|
|
42
|
+
headerMultipleButton: {
|
|
43
|
+
...centerRowItem,
|
|
44
|
+
},
|
|
45
|
+
bodyMultipleButton: {
|
|
46
|
+
flexWrap: 'nowrap',
|
|
47
|
+
...betweenRowItem,
|
|
48
|
+
justifyContent: 'space-around',
|
|
49
|
+
},
|
|
50
|
+
footerMultipleButton: {
|
|
51
|
+
...centerRowItem,
|
|
52
|
+
},
|
|
53
|
+
upButton: {
|
|
54
|
+
height: 58,
|
|
55
|
+
justifyContent: 'flex-start',
|
|
56
|
+
},
|
|
57
|
+
downButton: {
|
|
58
|
+
height: 58,
|
|
59
|
+
justifyContent: 'flex-end',
|
|
60
|
+
},
|
|
61
|
+
leftButton: {
|
|
62
|
+
width: 58,
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
alignItems: 'flex-start',
|
|
65
|
+
},
|
|
66
|
+
rightButton: {
|
|
67
|
+
width: 58,
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
alignItems: 'flex-end',
|
|
70
|
+
},
|
|
71
|
+
okButton: {
|
|
72
|
+
paddingTop: 5,
|
|
73
|
+
width: 70,
|
|
74
|
+
height: 70,
|
|
75
|
+
backgroundColor: Colors.Gray4,
|
|
76
|
+
borderRadius: 600,
|
|
77
|
+
...centerRowItem,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import { Colors } from '../../../../configs';
|
|
4
|
+
|
|
5
|
+
import styles from './ControlPlayStyles';
|
|
6
|
+
import { Pause } from './Icon';
|
|
7
|
+
import { TESTID } from '../../../../configs/Constants';
|
|
8
|
+
|
|
9
|
+
import { IconOutline } from '@ant-design/icons-react-native';
|
|
10
|
+
|
|
11
|
+
const ControlPlay = memo(
|
|
12
|
+
({ onPressPrev, onPressStop, onPressNext, wrapStyle }) => {
|
|
13
|
+
return (
|
|
14
|
+
<View style={[styles.wrapControlPlay, wrapStyle]}>
|
|
15
|
+
<TouchableOpacity
|
|
16
|
+
style={[styles.controlButton, styles.controlPrev]}
|
|
17
|
+
onPress={onPressPrev}
|
|
18
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.PREV_BUTTON}
|
|
19
|
+
>
|
|
20
|
+
<IconOutline
|
|
21
|
+
size={32}
|
|
22
|
+
name={'backward'}
|
|
23
|
+
color={Colors.Gray9}
|
|
24
|
+
style={[styles.button]}
|
|
25
|
+
/>
|
|
26
|
+
</TouchableOpacity>
|
|
27
|
+
<TouchableOpacity
|
|
28
|
+
style={[styles.controlButton, styles.controlStop]}
|
|
29
|
+
onPress={onPressStop}
|
|
30
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.STOP_BUTTON}
|
|
31
|
+
>
|
|
32
|
+
<Pause size={48} />
|
|
33
|
+
</TouchableOpacity>
|
|
34
|
+
<TouchableOpacity
|
|
35
|
+
style={[styles.controlButton, styles.controlNext]}
|
|
36
|
+
onPress={onPressNext}
|
|
37
|
+
testID={TESTID.SMART_TIVI_TEMPLATE.NEXT_BUTTON}
|
|
38
|
+
>
|
|
39
|
+
<IconOutline
|
|
40
|
+
size={32}
|
|
41
|
+
name={'forward'}
|
|
42
|
+
color={Colors.Gray9}
|
|
43
|
+
style={[styles.button]}
|
|
44
|
+
/>
|
|
45
|
+
</TouchableOpacity>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default ControlPlay;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Device } from '../../../../configs';
|
|
3
|
+
|
|
4
|
+
const widthMonitor = Device.screenWidth;
|
|
5
|
+
const centerRowItem = {
|
|
6
|
+
justifyContent: 'center',
|
|
7
|
+
alignItems: 'center',
|
|
8
|
+
};
|
|
9
|
+
const betweenRowItem = {
|
|
10
|
+
flexDirection: 'row',
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default StyleSheet.create({
|
|
15
|
+
controlButton: {
|
|
16
|
+
padding: 16,
|
|
17
|
+
...centerRowItem,
|
|
18
|
+
},
|
|
19
|
+
wrapControlPlay: {
|
|
20
|
+
flexWrap: 'nowrap',
|
|
21
|
+
width: widthMonitor - 130,
|
|
22
|
+
...betweenRowItem,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import SvgInput from '../../../../Images/Common/input.svg';
|
|
2
|
+
import VolumeUp from '../../../../Images/Common/volume_up.svg';
|
|
3
|
+
import KeyboardArrowUp from '../../../../Images/Common/keyboard_arrow_up.svg';
|
|
4
|
+
import KeyboardArrowDown from '../../../../Images/Common/keyboard_arrow_down.svg';
|
|
5
|
+
import Pause from '../../../../Images/Common/pause.svg';
|
|
6
|
+
import KeyboardReturn from '../../../../Images/Common/keyboard_return.svg';
|
|
7
|
+
import Home from '../../../../Images/Common/home.svg';
|
|
8
|
+
import Disney from '../../../../Images/Common/disney.svg';
|
|
9
|
+
import Youtube from '../../../../Images/Common/youtube.svg';
|
|
10
|
+
import Netflix from '../../../../Images/Common/netflix.svg';
|
|
11
|
+
import Spotify from '../../../../Images/Common/spotify.svg';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
SvgInput,
|
|
15
|
+
VolumeUp,
|
|
16
|
+
KeyboardArrowUp,
|
|
17
|
+
KeyboardArrowDown,
|
|
18
|
+
Pause,
|
|
19
|
+
KeyboardReturn,
|
|
20
|
+
Home,
|
|
21
|
+
Disney,
|
|
22
|
+
Youtube,
|
|
23
|
+
Netflix,
|
|
24
|
+
Spotify,
|
|
25
|
+
};
|