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
PMPL
Class Project
Kape
Commits
bb2114b6
Commit
bb2114b6
authored
Dec 06, 2019
by
Zulia Putri
🤤
Browse files
1606918446 223 2
parent
8669470d
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
assets/js/__test__/components/LoginForm-test.jsx
View file @
bb2114b6
...
...
@@ -63,7 +63,9 @@ describe('LoginForm', () => {
<
LoginForm
url
=
""
/>,
);
const
submitButton
=
ReactTestUtils
.
findRenderedDOMComponentWithTag
(
formLogin
,
'
Button
'
);
const
submitButton
=
ReactTestUtils
.
findRenderedDOMComponentWithClass
(
formLogin
,
'
submit
'
);
console
.
log
(
submitButton
);
ReactTestUtils
.
Simulate
.
click
(
submitButton
);
const
form
=
ReactTestUtils
.
findRenderedDOMComponentWithTag
(
formLogin
,
'
Form
'
);
...
...
@@ -77,7 +79,7 @@ describe('LoginForm', () => {
<
LoginForm
url
=
""
/>,
);
const
submitButton
=
ReactTestUtils
.
findRenderedDOMComponentWith
Tag
(
formLogin
,
'
Button
'
);
const
submitButton
=
ReactTestUtils
.
findRenderedDOMComponentWith
Class
(
formLogin
,
'
submit
'
);
ReactTestUtils
.
Simulate
.
click
(
submitButton
);
const
form
=
ReactTestUtils
.
findRenderedDOMComponentWithTag
(
formLogin
,
'
Form
'
);
...
...
assets/js/components/LoginForm.jsx
View file @
bb2114b6
...
...
@@ -33,17 +33,25 @@ export default class LoginForm extends React.Component {
this
.
state
=
{
username
:
''
,
password
:
''
,
hide
:
true
,
errorFlag
:
false
,
loading
:
false
,
};
this
.
handleChange
=
this
.
handleChange
.
bind
(
this
);
this
.
handleSubmit
=
this
.
handleSubmit
.
bind
(
this
);
this
.
handleClick
=
this
.
handleClick
.
bind
(
this
);
}
handleChange
(
event
,
name
)
{
this
.
setState
({
[
name
]:
event
.
target
.
value
});
}
handleClick
(
event
)
{
event
.
preventDefault
();
this
.
setState
({
hide
:
!
this
.
state
.
hide
});
}
handleSubmit
(
event
)
{
event
.
preventDefault
();
const
data
=
{
...
...
@@ -103,17 +111,22 @@ export default class LoginForm extends React.Component {
<
Form
.
Field
>
<
label
htmlFor
=
"password"
>
Password
</
label
>
<
Input
type
=
"password"
type
=
{
this
.
state
.
hide
?
"
password
"
:
"
text
"
}
id
=
"password"
icon
=
"key"
iconPosition
=
"left"
action
=
{
{
icon
:
this
.
state
.
hide
?
"
unhide
"
:
"
hide
"
,
onClick
:
this
.
handleClick
}
}
placeholder
=
"password"
value
=
{
this
.
state
.
password
}
onChange
=
{
(
e
)
=>
this
.
handleChange
(
e
,
'
password
'
)
}
required
/>
</
Form
.
Field
>
</
Form
.
Group
>
<
Button
type
=
"submit"
fluid
color
=
"blue"
>
<
Button
className
=
"submit"
type
=
"submit"
fluid
color
=
"blue"
>
Login
</
Button
>
<
Message
...
...
package-lock.json
View file @
bb2114b6
This diff is collapsed.
Click to expand it.
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