Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
red-giant
dashboard
Commits
3e5972bc
Verified
Commit
3e5972bc
authored
4 years ago
by
Defendi Alberto
Browse files
Options
Downloads
Patches
Plain Diff
Test login form existence
parent
4160ea05
No related branches found
Branches containing commit
No related tags found
2 merge requests
!11
Basic implementation of login page
,
!8
Test setup
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/App.tsx
+2
-2
2 additions, 2 deletions
src/App.tsx
src/components/LoginForm/LoginForm.test.tsx
+3
-7
3 additions, 7 deletions
src/components/LoginForm/LoginForm.test.tsx
src/components/LoginForm/LoginForm.tsx
+7
-2
7 additions, 2 deletions
src/components/LoginForm/LoginForm.tsx
with
12 additions
and
11 deletions
src/App.tsx
+
2
−
2
View file @
3e5972bc
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Form
}
from
'
./components/LoginForm/LoginForm
'
;
import
{
Login
Form
}
from
'
./components/LoginForm/LoginForm
'
;
export
const
App
:
React
.
FC
=
()
=>
(
export
const
App
:
React
.
FC
=
()
=>
(
<
div
className
=
"App"
data-testid
=
"App"
>
<
div
className
=
"App"
data-testid
=
"App"
>
<
header
className
=
"App-header"
>
<
header
className
=
"App-header"
>
<
Form
/>
<
Login
Form
/>
</
header
>
</
header
>
</
div
>
</
div
>
);
);
This diff is collapsed.
Click to expand it.
src/components/LoginForm/LoginForm.test.tsx
+
3
−
7
View file @
3e5972bc
...
@@ -2,13 +2,9 @@ import React from 'react';
...
@@ -2,13 +2,9 @@ import React from 'react';
import
{
render
,
fireEvent
}
from
'
@testing-library/react
'
;
import
{
render
,
fireEvent
}
from
'
@testing-library/react
'
;
import
{
LoginForm
}
from
'
./LoginForm
'
;
import
{
LoginForm
}
from
'
./LoginForm
'
;
describe
(
'
Email input
'
,
()
=>
{
describe
(
'
<LoginForm />
'
,
()
=>
{
it
(
'
Should handle email insertion and validation
'
);
it
(
'
renders form
'
,
()
=>
{
it
(
'
renders button
'
,
()
=>
{
const
wrapper
=
render
(<
LoginForm
/>);
const
wrapper
=
render
(<
LoginForm
/>);
expect
(
wrapper
.
queryByTestId
(
'
LoginForm
'
)).
toBeTruthy
();
console
.
log
(
wrapper
.
queryByTestId
(
'
LoginButton
'
));
expect
(
wrapper
.
queryByTestId
(
'
LoginButton
'
)).
toBeTruthy
();
});
});
});
});
This diff is collapsed.
Click to expand it.
src/components/LoginForm/LoginForm.tsx
+
7
−
2
View file @
3e5972bc
...
@@ -21,7 +21,7 @@ const useStyles = makeStyles((theme: Theme) =>
...
@@ -21,7 +21,7 @@ const useStyles = makeStyles((theme: Theme) =>
}),
}),
);
);
export
const
Form
:
React
.
FC
=
()
=>
{
export
const
Login
Form
:
React
.
FC
=
()
=>
{
interface
formData
{
interface
formData
{
email
:
string
;
email
:
string
;
password
:
string
;
password
:
string
;
...
@@ -49,7 +49,11 @@ export const Form: React.FC = () => {
...
@@ -49,7 +49,11 @@ export const Form: React.FC = () => {
const
classes
=
useStyles
();
const
classes
=
useStyles
();
return
(
return
(
<
form
className
=
{
classes
.
form
}
onSubmit
=
{
handleSubmit
}
>
<
form
className
=
{
classes
.
form
}
onSubmit
=
{
handleSubmit
}
data-testid
=
"LoginForm"
>
<
TextField
<
TextField
variant
=
"outlined"
variant
=
"outlined"
margin
=
"normal"
margin
=
"normal"
...
@@ -83,6 +87,7 @@ export const Form: React.FC = () => {
...
@@ -83,6 +87,7 @@ export const Form: React.FC = () => {
fullWidth
fullWidth
variant
=
"contained"
variant
=
"contained"
color
=
"primary"
color
=
"primary"
data-testid
=
"LoginButton"
className
=
{
classes
.
submit
}
className
=
{
classes
.
submit
}
>
>
Sign In
Sign In
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment