Skip to content

Commit

Permalink
test problems
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Aug 9, 2023
1 parent 8f0587d commit 8bdd346
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 29 deletions.
54 changes: 52 additions & 2 deletions __tests__/auth/register.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,57 @@


import { screen,render, getByRole, getByText,waitFor, act } from "@testing-library/react"
import userEvent from '@testing-library/user-event';
import ReactThemeProvider from "@/components/theme/themeReact/reactThemeProvider"
import IsAUserLoggedInProvider from "@/contexts/authContext"
import FireBooksProvider from "@/contexts/fireBooks"
import NotificationProvider from "@/contexts/notificationContext"
import DataProvider from "@/contexts/dataContext"
import BookProvider from "@/contexts/books"
import ThemeLayout from "@/components/theme/themeReact/themelayout"
import Header from "@/components/header/header"
import Footer from "@/components/footer/footer"
import LoginPage from "@/app/login/page";
import RootLayout from "@/app/layout";
import SignUpPage from "@/app/signup/page";
describe('resgister a user tests',()=>{
describe('rendering tests',()=>{
it('should have')
it('should enter correct info',async ()=>{

let component = null
await act(async()=>{
component = render(

<ReactThemeProvider>
<IsAUserLoggedInProvider>
<FireBooksProvider>
<NotificationProvider>
<DataProvider>
<BookProvider>
<ThemeLayout>
{/* <Header/> */}

<SignUpPage/>

<Footer/>
</ThemeLayout>
</BookProvider>
</DataProvider>
</NotificationProvider>
</FireBooksProvider>
</IsAUserLoggedInProvider>
</ReactThemeProvider>



)
})
const LoginLink = component.getByText(/login/i)
expect(LoginLink).toBeInTheDocument()
// await userEvent.type(screen.getByLabelText(/email/i),"abc@gmail.com")
// expect(screen.getByText(/abc/i)).toBeInTheDocument()



})
})
})
1 change: 1 addition & 0 deletions app/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default function RootLayout({ children }) {

return (
<html lang="en">
<head />
<body className={`${inter.className} body-blur`}>
{/* <Image src={CloudsImg} className="body-img" alt={"/"} priority/> */}
<div className="body-gradient"></div>
Expand Down
8 changes: 6 additions & 2 deletions components/auth/LoginForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,14 @@ const LoginForm = () => {
<form onSubmit={(e)=>handleSubmit(e)} className='auth-form'>

<label htmlFor='login-email' className='auth-label'>Email <span className='auth-demo'>demo: hayyim@email.com</span></label>
<input type='email' name="login-email" placeholder='Email' className='auth-input'
<input
id="login-email"
type='email' name="login-email" placeholder='Email' className='auth-input'
required onChange={(e)=>setEmail(e.target.value)}/>
<label htmlFor='login-password' className='auth-label'>Password <span className='auth-demo'>demo: hayyim</span></label>
<input type='password' name="login-password" className='auth-input'
<input
id="login-password"
type='password' name="login-password" className='auth-input'
placeholder='Password' required onChange={(e)=>setPassword(e.target.value)}/>
<button type='submit' className='auth-button'><span className={inter.className}>Login</span></button>
</form>
Expand Down
6 changes: 4 additions & 2 deletions components/auth/resetPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import { IsAUserLoggedInContext } from '@/contexts/authContext'
import { resetPassword } from '@/firebase/auth/reset'
import { useRouter } from 'next/navigation'
import React, { useContext, useState } from 'react'
import React, { useContext, useEffect, useState } from 'react'
import ReactDom from 'react-dom'
const ResetPortal = () => {
const {setOpenModal,setNotification}=useContext(IsAUserLoggedInContext)

const [email,setEmail]=useState("")
useEffect(()=>setDomReady(true),[])
const handleBack = ()=>{
setOpenModal((prev)=>false)
//window.navigator
Expand Down Expand Up @@ -39,6 +40,7 @@ const ResetPortal = () => {
</div>,
document.getElementById('portal')
)

}

export default ResetPortal
22 changes: 14 additions & 8 deletions components/auth/signUpForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SignUpForm = () => {
const [email,setEmail]=useState()
const [password,setPassword]=useState()
const [confirmPassword,setConfirmPassword]=useState()
const router = useRouter()

const {notification,setNotification,setOpenNotification,openNotification}=useContext(IsAUserLoggedInContext)
const handleSubmit = async(e)=>{
e.preventDefault()
Expand Down Expand Up @@ -47,7 +47,7 @@ const SignUpForm = () => {
console.log(err,"err")
}

router.push("/")
window.location.assign("/")
return
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ const SignUpForm = () => {



router.push("/")
window.location.assign("/")

}
}
Expand All @@ -106,7 +106,7 @@ const SignUpForm = () => {
console.log(err,"err")
}

router.push("/")
window.location.assign("/")
}

}
Expand All @@ -125,7 +125,7 @@ const SignUpForm = () => {
console.log(err,"err")
}

router.push("/")
window.location.assign("/")
}

}
Expand All @@ -135,13 +135,19 @@ const SignUpForm = () => {
<form onSubmit={(e)=>handleSubmit(e)} className='auth-form'>

<label htmlFor='sign-up-email' className='auth-label'>Email</label>
<input type='email' name="sign-up-email" placeholder='E-mail address' className='auth-input'
<input
id="sign-up-email"
type='email' name="sign-up-email" placeholder='E-mail address' className='auth-input'
required onChange={(e)=>setEmail(e.target.value)}/>
<label htmlFor='sign-up-password' className='auth-label'>Password</label>
<input type='password' name="sign-up-password" className='auth-input'
<input type='password'
id="sign-up-password"
name="sign-up-password" className='auth-input'
placeholder='Password' required onChange={(e)=>setPassword(e.target.value)}/>
<label htmlFor='sign-up-confirm-password' className='auth-label'>Confirm password</label>
<input type='password' name="sign-up-confirm-password" className='auth-input'
<input
id='sign-up-confirm-password'
type='password' name="sign-up-confirm-password" className='auth-input'
placeholder='Confirm password' required onChange={(e)=>setConfirmPassword(e.target.value)}/>
<button type='submit' className='auth-button'><span className={inter.className}>Sign up</span></button>
</form>
Expand Down
6 changes: 3 additions & 3 deletions components/header/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Header = () => {
setIsSearch(false)
setIsSettings(false)
if (isStrong && strongText!==null){
console.log(strongText,isStrong)
//console.log(strongText,isStrong)
setIsNote(true)
setIsStrong((prev)=>true)
const myElem = document.querySelector(".note-dict")
Expand All @@ -40,7 +40,7 @@ const Header = () => {
}

}
console.log(isNote,isStrong,"handleMEnu",strongText)
//console.log(isNote,isStrong,"handleMEnu",strongText)
}


Expand Down Expand Up @@ -77,7 +77,7 @@ const Header = () => {
<nav className='header-nav'>
<span className='header-menu' onClick={()=>setIsHamburger((prev)=>true)}><IconBxMenuAltLeft/></span>

{pathname==="/"? <span className={`header-book ${themeColor}Text`} onClick={()=>handleOpenToChapter()}
{pathname==="/"? <span className={` ${themeColor}Text header-book `} onClick={()=>handleOpenToChapter()}
>{chaptersAndVerses[displayTitle[0]].name} {displayTitle[1]+1}</span> : <span className='header-book'> {pathname.slice(1,2).toUpperCase()}{pathname.slice(2).toLowerCase()}</span>}

<span className='header-theme'><ReactThemeButton/></span>
Expand Down
2 changes: 1 addition & 1 deletion components/header/settingsHamburger.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const SettingsHamburger = ({isSettings,setIsSettings}) => {
const handleReset = ()=>{
setIsReset(true)
setTheme("light")
setThemeColor("navy")
setThemeColor("default")
setGlobalFontSize(16)
setGlobalLineHeight(1.5)

Expand Down
3 changes: 1 addition & 2 deletions contexts/books.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import { SearchStrongPagnation } from '@/app/api/bible/searchStrongPagnation'
import { useLocalStorage } from '@/hooks/hooks'
export const BookContext = createContext()
const BookProvider = ({children}) => {
const pathname = usePathname()
const router = useRouter()

const [wordsHighlighted,setWordsHighlighted]=useState([])
const [selectedWords,setSelectedWords]=useState([])
const [strongEng,setStrongEng]=useState("")
Expand Down
16 changes: 8 additions & 8 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
background-color:var(--red-2) ;
}
.redText {
color: var(--red);
color: var(--red) !important;
background-color: transparent;
}
.orange {
Expand All @@ -102,23 +102,23 @@
}

.orangeText {
color: var(--sunset);
color: var(--sunset) !important;
background-color: transparent;
}
.yellow {
color: #1c1c1c;
background-color:var(--yellow2) ;
}
.yellowText{
color: var(--yellow);
color: var(--yellow) !important;
background-color: transparent;
}
.green {
color: #1c1c1c;
background-color:var(--palegreen) ;
}
.greenText {
color: var(--darkgreen);
color: var(--darkgreen) !important;
background-color: transparent;
}
.blue {
Expand All @@ -127,15 +127,15 @@
}

.blueText {
color: var(--blue2);
color: var(--blue2) !important;
background-color: transparent;
}
.purple {
color: #1c1c1c;
background-color:var(--purple) ;
}
.purpleText {
color:var(--purple3);
color:var(--purple3) !important;
background-color:transparent;
}
.grey {
Expand All @@ -144,7 +144,7 @@
}

.greyText {
color: #393939;
color: #393939 !important;
background-color: transparent;
}

Expand All @@ -154,7 +154,7 @@
}

.defaultText {
color: var(--navy);
color: var(--navy) !important;
background-color: transparent;
}
* {
Expand Down
2 changes: 1 addition & 1 deletion styles/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
font-weight: 400;
}
.header-book {

color: var(--t-1);
font-size: var(--font-size-16);
font-weight: 500;
position: absolute;
Expand Down

1 comment on commit 8bdd346

@vercel
Copy link

@vercel vercel bot commented on 8bdd346 Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.