Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Mobile
Commits
9415366a
Commit
9415366a
authored
May 01, 2020
by
Irwanto
Committed by
Nandhika Prayoga
May 01, 2020
Browse files
Refactor and clean code
parent
d2215d0f
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
src/components/BaseMonitoringForm/__snapshots__/index.test.tsx.snap
View file @
9415366a
...
...
@@ -381,9 +381,9 @@ exports[`renders correctly 1`] = `
]
}
>
Sri Tanjung
Budi
|
19
88
Tahun,
Laki-laki
</Text>
...
...
@@ -402,513 +402,7 @@ exports[`renders correctly 1`] = `
]
}
>
Pondok Cina, Beji
</Text>
<View
paddingBottom={5}
paddingLeft={0}
paddingRight={0}
paddingTop={5}
style={
Array [
Object {
"flexBasis": "auto",
"flexGrow": 0,
"flexShrink": 0,
"paddingBottom": 5,
"paddingLeft": 0,
"paddingRight": 0,
"paddingTop": 5,
},
]
}
/>
<View
style={
Array [
Object {
"backgroundColor": "#f5f5f5",
"borderRadius": 40,
"width": "60%",
},
]
}
>
<Text
align="center"
fontSize="16px"
fontWeight="Bold"
style={
Array [
Object {
"color": "black",
"fontFamily": "Dosis-Bold",
"fontSize": 16,
"textAlign": "center",
"width": "auto",
},
]
}
>
Status:
</Text>
<Text
align="center"
fontSize="16px"
fontWeight="Bold"
style={
Array [
Object {
"color": "black",
"fontFamily": "Dosis-Bold",
"fontSize": 16,
"textAlign": "center",
"width": "auto",
},
]
}
>
Belum Diperiksa
</Text>
</View>
</View>
</View>
</View>
</RCTScrollView>
</View>
</View>
</View>
</View>
</View>
</View>
</View>
</View>
<View
pointerEvents="box-none"
style={
Object {
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<View
accessibilityElementsHidden={false}
importantForAccessibility="auto"
onLayout={[Function]}
pointerEvents="box-none"
style={null}
/>
</View>
</RNCSafeAreaView>
</View>
`;
exports[`renders correctly 2`] = `
<View
style={
Object {
"flex": 1,
}
}
>
<RNCSafeAreaView
onInsetsChange={[Function]}
style={
Object {
"flex": 1,
}
}
>
<View
onLayout={[Function]}
style={
Object {
"flex": 1,
"overflow": "hidden",
}
}
>
<View
pointerEvents="box-none"
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
>
<View
accessibilityElementsHidden={false}
closing={false}
gestureVelocityImpact={0.3}
importantForAccessibility="auto"
onClose={[Function]}
onGestureBegin={[Function]}
onGestureCanceled={[Function]}
onOpen={[Function]}
onTransitionStart={[Function]}
pointerEvents="box-none"
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
transitionSpec={
Object {
"close": Object {
"animation": "spring",
"config": Object {
"damping": 500,
"mass": 3,
"overshootClamping": true,
"restDisplacementThreshold": 0.01,
"restSpeedThreshold": 0.01,
"stiffness": 1000,
},
},
"open": Object {
"animation": "spring",
"config": Object {
"damping": 500,
"mass": 3,
"overshootClamping": true,
"restDisplacementThreshold": 0.01,
"restSpeedThreshold": 0.01,
"stiffness": 1000,
},
},
}
}
>
<View
pointerEvents="box-none"
style={
Object {
"flex": 1,
"marginTop": 64,
}
}
>
<View
collapsable={false}
forwardedRef={[Function]}
onGestureHandlerEvent={[Function]}
onGestureHandlerStateChange={[Function]}
style={
Object {
"flex": 1,
"transform": Array [
Object {
"translateX": 0,
},
Object {
"translateX": 0,
},
],
}
}
>
<View
pointerEvents="none"
style={
Object {
"backgroundColor": "#fff",
"bottom": 0,
"left": 0,
"position": "absolute",
"shadowColor": "#000",
"shadowOffset": Object {
"height": 1,
"width": -1,
},
"shadowOpacity": 0.3,
"shadowRadius": 5,
"top": 0,
"width": 3,
}
}
/>
<View
style={
Array [
Object {
"flex": 1,
"overflow": "hidden",
},
Array [
Object {
"backgroundColor": "rgb(242, 242, 242)",
},
undefined,
],
]
}
>
<View
style={
Object {
"flex": 1,
"flexDirection": "column-reverse",
}
}
>
<View
style={
Object {
"flex": 1,
}
}
>
<RCTScrollView
style={
Array [
Object {
"backgroundColor": "#ffffff",
},
]
}
>
<View>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"display": "flex",
},
]
}
>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"backgroundColor": "white",
},
]
}
>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"backgroundColor": "#f5f5f5",
"borderBottomRightRadius": 70,
"justifyContent": "center",
"minHeight": 150,
},
]
}
>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"marginTop": "5%",
"paddingBottom": 20,
"paddingLeft": 20,
"paddingRight": 20,
"paddingTop": 20,
},
]
}
>
<View
style={
Array [
Object {
"height": "NaN",
"width": "NaN",
},
]
}
>
<View
accessible={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"backgroundColor": "transparent",
"borderColor": "#42c41d",
"borderRadius": 3,
"borderWidth": 0.8,
"flexBasis": "auto",
"flexGrow": 1,
"flexShrink": 0,
"height": "auto",
"justifyContent": "center",
"opacity": 1,
"paddingBottom": 12,
"paddingLeft": 36,
"paddingRight": 36,
"paddingTop": 12,
"width": "auto",
}
}
>
<Text
color="#9d9e9d"
fontSize="16px"
fontWeight="Bold"
style={
Array [
Object {
"color": "#9d9e9d",
"fontFamily": "Dosis-Bold",
"fontSize": 16,
"textAlign": "left",
"width": "auto",
},
]
}
>
Beranda
</Text>
</View>
</View>
<View
style={
Array [
Object {
"marginTop": "10%",
"width": "NaN",
},
]
}
>
<Text
fontSize="16px"
fontWeight="Regular"
style={
Array [
Object {
"color": "black",
"fontFamily": "Dosis-Regular",
"fontSize": 16,
"textAlign": "left",
"width": "auto",
},
]
}
>
This is header
</Text>
</View>
</RCTSafeAreaView>
</RCTSafeAreaView>
</RCTSafeAreaView>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"backgroundColor": "#f5f5f5",
},
]
}
>
<RCTSafeAreaView
emulateUnlessSupported={true}
style={
Array [
Object {
"backgroundColor": "white",
"borderTopLeftRadius": 80,
"justifyContent": "center",
"minHeight": 30,
},
]
}
/>
</RCTSafeAreaView>
</RCTSafeAreaView>
<View
style={
Array [
Object {
"backgroundColor": "#ffffff",
"paddingBottom": 12,
"paddingLeft": 12,
"paddingRight": 12,
"paddingTop": 0,
},
]
}
>
<View
style={
Array [
Object {
"backgroundColor": "#fafafa",
"borderBottomRightRadius": 60,
"borderTopLeftRadius": 20,
"marginBottom": 20,
"paddingBottom": 12,
"paddingLeft": 12,
"paddingRight": 12,
"paddingTop": 18,
},
]
}
>
<Text
fontSize="16px"
fontWeight="Regular"
style={
Array [
Object {
"color": "black",
"fontFamily": "Dosis-Regular",
"fontSize": 16,
"textAlign": "left",
"width": "auto",
},
]
}
>
Sri Tanjung
|
19
Tahun,
Perempuan
</Text>
<Text
fontSize="16px"
fontWeight="Regular"
style={
Array [
Object {
"color": "black",
"fontFamily": "Dosis-Regular",
"fontSize": 16,
"textAlign": "left",
"width": "auto",
},
]
}
>
Pondok Cina, Beji
Depok
</Text>
<View
paddingBottom={5}
...
...
src/components/BaseMonitoringForm/index.test.tsx
View file @
9415366a
...
...
@@ -5,12 +5,29 @@ import {createStackNavigator} from '@react-navigation/stack';
import
BaseMonitoringForm
from
'
.
'
;
import
renderer
from
'
react-test-renderer
'
;
import
{
AppContext
}
from
'
contexts
'
;
import
MonitoringStatus
from
'
components/MonitoringStatus
'
;
const
Stack
=
createStackNavigator
();
const
testProps
=
{
cache
:
{
monitoringCaseFormData
:
{
investigation_case
:
{
case_subject
:
{
name
:
"
Budi
"
,
age
:
"
88
"
,
is_male
:
true
,
address
:
"
Depok
"
}
},
state
:
"
Belum Diperiksa
"
,
}
}
}
it
(
'
renders correctly
'
,
()
=>
{
le
t
defaultPage
=
renderer
.
create
(
cons
t
defaultPage
=
renderer
.
create
(
<
AppContext
.
Provider
value
=
{
testProps
}
>
<
NavigationContainer
>
<
Stack
.
Navigator
screenOptions
=
{
{
...
...
@@ -21,45 +38,20 @@ it('renders correctly', () => {
component
=
{
()
=>
<
BaseMonitoringForm
header
=
"This is header"
name
=
'Sri Tanjung'
age
=
'19'
is_male
=
{
true
}
address
=
'Pondok Cina, Beji'
status
=
'Belum Diperiksa'
/>
}
/>
</
Stack
.
Navigator
>
</
NavigationContainer
>
)
.
toJSON
(
);
</
AppContext
.
Provider
>
);
expect
(
defaultPage
).
toMatchSnapshot
();
expect
(
defaultPage
.
toJSON
()
).
toMatchSnapshot
();
defaultPage
=
renderer
.
create
(
<
NavigationContainer
>
<
Stack
.
Navigator
screenOptions
=
{
{
header
:
()
=>
<></>,
}
}
>
<
Stack
.
Screen
name
=
"baseform"
component
=
{
()
=>
<
BaseMonitoringForm
header
=
"This is header"
name
=
'Sri Tanjung'
age
=
'19'
is_male
=
{
false
}
address
=
'Pondok Cina, Beji'
status
=
'Belum Diperiksa'
/>
}
/>