generated from muratkeremozcan/react-cypress-ts-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from cesarhenrq/qa
4023-feat--base-layout
- Loading branch information
Showing
11 changed files
with
184 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import GlobalStyle from '@styles/global'; | ||
|
||
import BaseLayout from '@pages/BaseLayout'; | ||
|
||
export default function App() { | ||
return ( | ||
<div className="App"> | ||
<GlobalStyle /> | ||
it works! | ||
<BaseLayout>it works!</BaseLayout> | ||
</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
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 |
---|---|---|
|
@@ -23,59 +23,57 @@ const Footer = () => { | |
}; | ||
|
||
return ( | ||
<> | ||
<S.Footer data-cy="footer"> | ||
<S.Line data-cy="line" /> | ||
<S.Footer data-cy="footer"> | ||
<div className="text-container" data-cy="logo"> | ||
<Text label="meta" fontColor="white" fontSize="large" /> | ||
<Text | ||
label="vagas" | ||
fontColor="yellow" | ||
fontStyle="italic" | ||
fontSize="large" | ||
fontWeight="600" | ||
/> | ||
</div> | ||
<S.ContactInfo data-cy="contact-info"> | ||
<Text label="Contato e Endereço" fontColor="yellow" /> | ||
<S.ContactInfoItem | ||
data-cy="contact-info-phone" | ||
className="contact-info-item" | ||
> | ||
<S.Circle> | ||
<Telephone {...iconProps} /> | ||
</S.Circle> | ||
<Text label="4003-5442" fontColor="white" /> | ||
</S.ContactInfoItem> | ||
<S.ContactInfoItem data-cy="contact-info-email"> | ||
<S.Circle> | ||
<Message {...iconProps} /> | ||
</S.Circle> | ||
<Text label="[email protected]" fontColor="white" /> | ||
</S.ContactInfoItem> | ||
<S.ContactInfoItem data-cy="contact-info-adress"> | ||
<S.Circle> | ||
<Location {...iconProps} /> | ||
</S.Circle> | ||
<Text label={adressText} fontColor="white" data-cy="text-adress" /> | ||
</S.ContactInfoItem> | ||
</S.ContactInfo> | ||
<div className="button-container" data-cy="auth-buttons"> | ||
<Button | ||
label="Entrar" | ||
onClick={dummy} | ||
backgroundColor="purple-dark" | ||
fontColor="white" | ||
borderColor="white" | ||
/> | ||
<Button | ||
label="Cadastrar-se gratuitamente" | ||
onClick={dummy} | ||
borderColor="yellow" | ||
/> | ||
</div> | ||
</S.Footer> | ||
</> | ||
<div className="text-container" data-cy="logo"> | ||
<Text label="meta" fontColor="white" fontSize="large" /> | ||
<Text | ||
label="vagas" | ||
fontColor="yellow" | ||
fontStyle="italic" | ||
fontSize="large" | ||
fontWeight="600" | ||
/> | ||
</div> | ||
<S.ContactInfo data-cy="contact-info"> | ||
<Text label="Contato e Endereço" fontColor="yellow" /> | ||
<S.ContactInfoItem | ||
data-cy="contact-info-phone" | ||
className="contact-info-item" | ||
> | ||
<S.Circle> | ||
<Telephone {...iconProps} /> | ||
</S.Circle> | ||
<Text label="4003-5442" fontColor="white" /> | ||
</S.ContactInfoItem> | ||
<S.ContactInfoItem data-cy="contact-info-email"> | ||
<S.Circle> | ||
<Message {...iconProps} /> | ||
</S.Circle> | ||
<Text label="[email protected]" fontColor="white" /> | ||
</S.ContactInfoItem> | ||
<S.ContactInfoItem data-cy="contact-info-adress"> | ||
<S.Circle> | ||
<Location {...iconProps} /> | ||
</S.Circle> | ||
<Text label={adressText} fontColor="white" data-cy="text-adress" /> | ||
</S.ContactInfoItem> | ||
</S.ContactInfo> | ||
<div className="button-container" data-cy="auth-buttons"> | ||
<Button | ||
label="Entrar" | ||
onClick={dummy} | ||
backgroundColor="purple-dark" | ||
fontColor="white" | ||
borderColor="white" | ||
/> | ||
<Button | ||
label="Cadastrar-se gratuitamente" | ||
onClick={dummy} | ||
borderColor="yellow" | ||
/> | ||
</div> | ||
</S.Footer> | ||
); | ||
}; | ||
|
||
|
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,21 @@ | ||
import BaseLayout from './BaseLayout'; | ||
import GlobalStyle from '@styles/global'; | ||
|
||
const Sut = () => ( | ||
<> | ||
<GlobalStyle /> | ||
<BaseLayout> | ||
<div>children</div> | ||
</BaseLayout> | ||
</> | ||
); | ||
|
||
describe('<BaseLayout />', () => { | ||
beforeEach(() => { | ||
cy.mount(<Sut />); | ||
}); | ||
|
||
it('should main content has padding-top: 6.4375rem', () => { | ||
cy.getByCy('main-content').should('have.css', 'padding-top', '103px'); | ||
}); | ||
}); |
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,31 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import BaseLayout from './BaseLayout'; | ||
|
||
describe('<BaseLayout />', () => { | ||
beforeEach(() => { | ||
render( | ||
<BaseLayout> | ||
<div data-cy="children"> | ||
<p>children</p> | ||
</div> | ||
</BaseLayout>, | ||
); | ||
}); | ||
|
||
it('should render the header', () => { | ||
screen.getByTestId('header'); | ||
}); | ||
|
||
it('should render the footer', () => { | ||
screen.getByTestId('footer'); | ||
}); | ||
|
||
it('should render the main content', () => { | ||
screen.getByTestId('main-content'); | ||
}); | ||
|
||
it('should render the children', () => { | ||
screen.getByTestId('children'); | ||
}); | ||
}); |
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,22 @@ | ||
import React from 'react'; | ||
|
||
import Header from '@components/Header'; | ||
import Footer from '@components/Footer'; | ||
|
||
import * as S from './styles'; | ||
|
||
type BaseLayoutProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
const BaseLayout = ({ children }: BaseLayoutProps) => { | ||
return ( | ||
<> | ||
<Header /> | ||
<S.Main data-cy="main-content">{children}</S.Main> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
export default BaseLayout; |
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 @@ | ||
export { default } from './BaseLayout'; |
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,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const Main = styled.main` | ||
padding-top: 6.4375rem; | ||
`; |