-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
896f0b0
commit cbd16f8
Showing
66 changed files
with
2,224 additions
and
1,685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage | ||
*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"useTabs": false, | ||
"bracketSpacing": true, | ||
"bracketSameLine": true, | ||
"arrowParens": "always", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// https://www.npmjs.com/package/@typescript-eslint/eslint-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import Routes from "./core/configs/App"; | ||
import Routes from './core/configs/App'; | ||
|
||
export default Routes | ||
export default Routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import { render, screen } from "@testing-library/react" | ||
import { ErrorMsg } from '.' | ||
import { render, screen } from '@testing-library/react'; | ||
import { ErrorMsg } from '.'; | ||
|
||
describe('<ErrorMsg />', () => { | ||
it('should render h1', () => { | ||
render(<ErrorMsg msg="Mensagem de erro de exemplo" />) | ||
expect(screen.getByText(/Mensagem de erro de exemplo/i)).toBeInTheDocument() | ||
}) | ||
render(<ErrorMsg msg="Mensagem de erro de exemplo" />); | ||
expect( | ||
screen.getByText(/Mensagem de erro de exemplo/i), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should match snapshot', () => { | ||
const { container } = render(<ErrorMsg msg="Mensagem de erro de exemplo" />) | ||
expect(container.firstChild).toMatchSnapshot() | ||
}) | ||
}) | ||
const { container } = render( | ||
<ErrorMsg msg="Mensagem de erro de exemplo" />, | ||
); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import React from "react" | ||
|
||
interface propsInterface { | ||
msg: string | ||
msg: string; | ||
} | ||
|
||
export const ErrorMsg = ({ msg }: propsInterface) => { | ||
return <p className="errorMsg">{msg}</p> | ||
} | ||
return <p className="errorMsg">{msg}</p>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { render, screen } from "@testing-library/react" | ||
import { Img } from '.' | ||
import { render, screen } from '@testing-library/react'; | ||
import { Img } from '.'; | ||
|
||
describe('<Img />', () => { | ||
it('should render image', () => { | ||
render(<Img src='image.png' alt="um texto qualquer" />) | ||
expect(screen.getByRole('img', {name: 'um texto qualquer'})).toBeInTheDocument() | ||
}) | ||
}) | ||
render(<Img src="image.png" alt="um texto qualquer" />); | ||
expect( | ||
screen.getByRole('img', { name: 'um texto qualquer' }), | ||
).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import React from "react"; | ||
|
||
interface propsInterface { | ||
src: string, | ||
alt: string | ||
src: string; | ||
alt: string; | ||
} | ||
|
||
export const Img = ({ src, alt }: propsInterface) => { | ||
return <img src={src} alt={alt} /> | ||
} | ||
return <img src={src} alt={alt} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
type typeInput = 'text' | 'password' | 'email' | ||
type typeInput = 'text' | 'password' | 'email'; | ||
|
||
interface propsInterface { | ||
text: string, | ||
value: string, | ||
type: typeInput, | ||
disabled?: boolean, | ||
setValue: (e: any) => void | ||
text: string; | ||
value: string; | ||
type: typeInput; | ||
disabled?: boolean; | ||
setValue: (e: any) => void; | ||
} | ||
|
||
export const Input = (props: propsInterface) => { | ||
const disabled = props.disabled ?? false | ||
const disabled = props.disabled ?? false; | ||
|
||
return ( | ||
<div className="groupInput"> | ||
<div className="groupInputSelet"> | ||
<label htmlFor="">{props.text}</label> | ||
<input disabled={disabled} type={props.type} value={props.value} placeholder={props.text} onChange={(e) => props.setValue(e.target.value)} /> | ||
<input | ||
disabled={disabled} | ||
type={props.type} | ||
value={props.value} | ||
placeholder={props.text} | ||
onChange={(e) => props.setValue(e.target.value)} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,40 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event' | ||
import { Input } from '.' | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { Input } from '.'; | ||
|
||
describe('should test input component', () => { | ||
it('should render input', () => { | ||
const fn = jest.fn() | ||
render(<Input | ||
text="Description from input" | ||
value="" | ||
type="text" | ||
disabled={false} | ||
setValue={fn} />) | ||
|
||
expect(screen.getByPlaceholderText(/Description from input/i)).toBeInTheDocument() | ||
}) | ||
const fn = jest.fn(); | ||
render( | ||
<Input | ||
text="Description from input" | ||
value="" | ||
type="text" | ||
disabled={false} | ||
setValue={fn} | ||
/>, | ||
); | ||
|
||
expect( | ||
screen.getByPlaceholderText(/Description from input/i), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should call handleChange function on each key pressed', () => { | ||
const fn = jest.fn() | ||
render(<Input | ||
text="Description from input" | ||
value="" | ||
type="text" | ||
disabled={false} | ||
setValue={fn} />) | ||
const fn = jest.fn(); | ||
render( | ||
<Input | ||
text="Description from input" | ||
value="" | ||
type="text" | ||
disabled={false} | ||
setValue={fn} | ||
/>, | ||
); | ||
|
||
const input: any = screen.getByPlaceholderText(/Description from input/i) | ||
const input: any = screen.getByPlaceholderText(/Description from input/i); | ||
|
||
userEvent.type(input, 'a any text') | ||
expect(fn).toHaveBeenCalledTimes('a any text'.length) | ||
}) | ||
}) | ||
userEvent.type(input, 'a any text'); | ||
expect(fn).toHaveBeenCalledTimes('a any text'.length); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import { LoaderComponent } from '.' | ||
import { render, screen } from '@testing-library/react'; | ||
import { LoaderComponent } from '.'; | ||
|
||
describe('<LoaderComponent />', () => { | ||
it('should render LoaderComponent', () => { | ||
render(<LoaderComponent active={true} />) | ||
expect(screen.getByTestId('loader')).toBeInTheDocument() | ||
}) | ||
render(<LoaderComponent active={true} />); | ||
expect(screen.getByTestId('loader')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should not render LoaderComponent if active === false', () => { | ||
render(<LoaderComponent active={false} />) | ||
expect(screen.queryByTestId('loader')).not.toBeInTheDocument() | ||
}) | ||
|
||
}) | ||
render(<LoaderComponent active={false} />); | ||
expect(screen.queryByTestId('loader')).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
interface propsInterface { | ||
text: string, | ||
value: string, | ||
setValue: (event: any) => void, | ||
render: () => any[] | ||
text: string; | ||
value: string; | ||
setValue: (event: any) => void; | ||
render: () => any[]; | ||
} | ||
|
||
export const Selected = (props: propsInterface) => { | ||
|
||
function renderItems() { | ||
return props.render?.().map(item => { | ||
return <option value={item.name} key={item.id} >{item.name}</option> | ||
}) | ||
return props.render?.().map((item) => { | ||
return ( | ||
<option value={item.name} key={item.id}> | ||
{item.name} | ||
</option> | ||
); | ||
}); | ||
} | ||
|
||
return ( | ||
<div className="groupInputSelet"> | ||
<label>{props.text}</label> | ||
<select value={props.value} onChange={(e) => props.setValue(e.target.value)} > | ||
<option value=""></option> | ||
<select | ||
value={props.value} | ||
onChange={(e) => props.setValue(e.target.value)}> | ||
<option value=""></option> | ||
{renderItems()} | ||
</select> | ||
</div> | ||
) | ||
} | ||
); | ||
}; |
Oops, something went wrong.