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
PPL KI Ganjil 2021 2022
Clicks - Ecosystem Business
clicks-frontend
Commits
6aaf01d4
Commit
6aaf01d4
authored
Oct 06, 2021
by
Bagus Prabowo
Committed by
angelin depthios
Oct 06, 2021
Browse files
Feature: Arrowless Plain button
parent
3164556e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/components/__tests__/Buttons/ArrowlessPlainButton.test.tsx
0 → 100644
View file @
6aaf01d4
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import
React
from
"
react
"
;
import
{
cleanup
,
render
}
from
"
@testing-library/react-native
"
;
import
ArrowlessPlainButton
from
"
../../button/ArrowlessPlainButton
"
;
afterEach
(
cleanup
);
const
ArrowlessWrapper
=
()
=>
{
return
<
ArrowlessPlainButton
content
=
"Test"
onPress
=
{
()
=>
{}
}
/>;
};
describe
(
"
Arrowless Plain Button Test
"
,
()
=>
{
it
(
"
Should detect a touchable component
"
,
()
=>
{
const
{
getByTestId
}
=
render
(<
ArrowlessWrapper
/>);
expect
(
getByTestId
(
"
Touchable
"
)).
not
.
toBeNull
();
});
it
(
"
Should detect a view component
"
,
()
=>
{
const
{
getByTestId
}
=
render
(<
ArrowlessWrapper
/>);
expect
(
getByTestId
(
"
View
"
)).
not
.
toBeNull
();
});
it
(
"
Should detect a text component
"
,
()
=>
{
const
{
getByTestId
}
=
render
(<
ArrowlessWrapper
/>);
expect
(
getByTestId
(
"
Text
"
)).
not
.
toBeNull
();
});
});
src/components/button/ArrowlessPlainButton.tsx
0 → 100644
View file @
6aaf01d4
import
React
from
"
react
"
;
import
{
StyleSheet
,
TouchableOpacity
,
Text
,
View
}
from
"
react-native
"
;
import
Colors
from
"
../../constants/Colors
"
;
type
props
=
{
content
:
string
;
onPress
:
()
=>
void
;
};
const
ArrowlessPlainButton
=
({
content
=
""
,
onPress
}:
props
)
=>
{
return
(
<
TouchableOpacity
style
=
{
styles
.
touchableContainer
}
onPress
=
{
()
=>
onPress
()
}
testID
=
"Touchable"
>
<
View
style
=
{
styles
.
textContainer
}
testID
=
"View"
>
<
Text
style
=
{
styles
.
content
}
testID
=
"Text"
>
{
content
}
</
Text
>
</
View
>
</
TouchableOpacity
>
);
};
const
styles
=
StyleSheet
.
create
({
touchableContainer
:
{
width
:
"
100%
"
,
},
textContainer
:
{
backgroundColor
:
Colors
.
background
,
borderColor
:
Colors
.
form
.
filled
.
border
,
borderWidth
:
1
,
borderRadius
:
8
,
height
:
52
,
justifyContent
:
"
center
"
,
},
content
:
{
color
:
Colors
.
text
.
subtitle
,
fontSize
:
14
,
paddingHorizontal
:
8
,
fontWeight
:
"
300
"
,
},
});
export
default
ArrowlessPlainButton
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment