Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
Luxshan2000 committed Oct 15, 2023
1 parent b48f403 commit f8b152d
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 22 deletions.
4 changes: 4 additions & 0 deletions webapp/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"]
}

1 change: 1 addition & 0 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "webapp",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@greatsumini/react-facebook-login": "^3.3.3",
"@react-oauth/google": "^0.11.1",
Expand Down
117 changes: 117 additions & 0 deletions webapp/src/Todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import React, { useEffect, useState } from "react";
import FloatingLabel from 'react-bootstrap/FloatingLabel';
import Form from 'react-bootstrap/Form';

import Button from 'react-bootstrap/Button';
import Spinner from 'react-bootstrap/Spinner';
import Alert from 'react-bootstrap/Alert';





export default function Todo() {



const [email,setEmail] = useState("")
const [password,setPassword] = useState("")

const [validated, setValidated] = useState(false)

const [loading, setLoading] = useState(false)
const [feedBack, setFeedback] = useState()











return (
<div className="container-fluid" style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}>
<div className="blurEffect" style={{ width: '500px' }}>
<h1 className="mb-4" style={{textAlign:'center'}}>LOGIN</h1>
<Form noValidate validated={validated} >

<FloatingLabel
controlId="floatingInput"
label="Email address"
className="mb-3"
style={{ fontSize: 'small' }}
>
<Form.Control onChange={(e)=>setEmail(e.target.value)} value={email} type="email" size="sm" placeholder="[email protected]" required />
<Form.Control.Feedback type="invalid">Please put a valid email!</Form.Control.Feedback>
</FloatingLabel>

<FloatingLabel
controlId="floatingPassword"
label="Password"
// className="mb-3"
style={{ fontSize: 'small' }}
>
<Form.Control required onChange={(e)=>setPassword(e.target.value)} value={password} type="password" placeholder="Password" />
<Form.Control.Feedback type="invalid">Password cann't be empty!</Form.Control.Feedback>
</FloatingLabel>


<div style={{textAlign:'left'}}>
<a href='/resetpassword' style={{fontSize:12,}}>
Forgot your password?
</a>
</div>

{feedBack && <Alert onClose={()=> setFeedback("") } variant="danger" className=" text-center" dismissible >{feedBack}</Alert> }

<div style={{ display: 'flex', flexDirection: 'column',marginTop: '50px'}}>
<Button type="submit" className="mb-3 task-button">
{loading? (<Spinner color="gray" animation="border" />) :"Login" }
</Button>
{/* <hr className="hr-lines"/>
<p>OR</p> */}
<p className="hr-line"><span>OR</span></p>



{/* <Button type="submit" className="mb-3 task-button" style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<div style={{ flex: 1 / 3, textAlign: 'start' }}>
<i className="bi bi-google"></i>
</div>
<div style={{ flex: 2 / 3, textAlign: 'start' }}>
Login with Google
</div>
</Button> */}
{/* <Button className="mb-3 task-button" style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
<div style={{ flex: 1 / 3, textAlign: 'start' }}>
<i className="bi bi-facebook"></i>
</div>
<div style={{ flex: 2 / 3, textAlign: 'start' }}>
Login with Facebook
</div>
</Button> */}





<p className="mb-3" style={{ fontSize: '12', fontWeight: 'lighter',textAlign:'center'}}>
If you haven't registered yet? <a href='/signup'><span>Register now</span></a>
</p>
</div>
</Form>





</div>
</div >

)
}
3 changes: 3 additions & 0 deletions webapp/src/__tests__/Login.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test('Login test ', () => {
expect(true).toBe(true)
})
22 changes: 0 additions & 22 deletions webapp/src/__tests__/SignUp.test.js

This file was deleted.

8 changes: 8 additions & 0 deletions webapp/src/__tests__/Todo.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import Todo from '../Todo';

test('renders learn react link', () => {
render(<Todo />);
// const linkElement = screen.getByText(/learn react/i);
// expect(linkElement).toBeInTheDocument();
});
5 changes: 5 additions & 0 deletions webapp/src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

0 comments on commit f8b152d

Please sign in to comment.