forked from Arquisoft/wiq_0
-
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 #158 from Arquisoft/86-añadir-sistema-de-ayuda
Añadido sistema de ayuda
- Loading branch information
Showing
14 changed files
with
420 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,60 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Heading, Table, Thead, Tbody, Tr, Th, Td } from '@chakra-ui/react'; | ||
import Nav from '../../components/Nav/Nav'; | ||
import Footer from '../../components/Footer/Footer'; | ||
|
||
const Ayuda = () => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<Nav /> | ||
<Heading as="h1">{t('pages.help.title')}</Heading> | ||
<Heading as="h2" size="md"> | ||
{t('pages.help.description')} | ||
</Heading> | ||
<Table className="help-table" id="help-table"> | ||
<Thead> | ||
<Tr> | ||
<Th>{t('pages.help.category')}</Th> | ||
<Th>{t('pages.help.descriptionC')}</Th> | ||
<Th>{t('pages.help.details')}</Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
<Tr> | ||
<Td>{t('pages.help.gameModes')}</Td> | ||
<Td> | ||
{t('pages.help.gameModesDescription')} | ||
</Td> | ||
<Td> | ||
<a href="/ayuda/modos-de-juego">{t('pages.help.moreDetails')}</a> | ||
</Td> | ||
</Tr> | ||
<Tr> | ||
<Td>{t('pages.help.socialHelp')}</Td> | ||
<Td> | ||
{t('pages.help.socialHelpDescription')} | ||
</Td> | ||
<Td> | ||
<a href="/ayuda/social">{t('pages.help.moreDetails')}</a> | ||
</Td> | ||
</Tr> | ||
<Tr> | ||
<Td>{t('pages.help.statsHelp')}</Td> | ||
<Td> | ||
{t('pages.help.statsHelpDescription')} | ||
</Td> | ||
<Td> | ||
<a href="/ayuda/estadisticas">{t('pages.help.moreDetails')}</a> | ||
</Td> | ||
</Tr> | ||
</Tbody> | ||
</Table> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
export default Ayuda; |
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,58 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import Ayuda from './Ayuda'; | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
import { I18nextProvider } from "react-i18next"; | ||
import i18n from "../../i18n.js"; | ||
|
||
describe('Ayuda Component', () => { | ||
|
||
const renderComponentWithRouter = () => { | ||
return render( | ||
<I18nextProvider i18n={i18n}> | ||
<Router> | ||
<Ayuda /> | ||
</Router> | ||
</I18nextProvider> | ||
); | ||
}; | ||
|
||
it('renders component without crashing', () => { | ||
renderComponentWithRouter(); | ||
}); | ||
|
||
it('renders the correct title and description', () => { | ||
const { getByText} = renderComponentWithRouter(); | ||
const titleElement = getByText("Centro de ayuda"); | ||
const descriptionElement = getByText(/Bienvenido al centro de ayuda de nuestra aplicación. Aquí encontrarás información útil para sacar el máximo provecho de nuestro juego/i); | ||
expect(titleElement).toBeInTheDocument(); | ||
expect(descriptionElement).toBeInTheDocument(); | ||
}); | ||
|
||
it('renders the correct help categories and descriptions with more details links', () => { | ||
const { getByText,getAllByText } = renderComponentWithRouter(); | ||
|
||
const categoriesAndDescriptions = [ | ||
{ | ||
description: /En nuestra aplicación tenemos 3 modos de juego con los que podrás entretenerte, en esta sección esperamos responder todas tus dudas./, | ||
moreDetails: /Más detalles/ | ||
}, | ||
{ | ||
description: /Tenemos diferentes maneras de interactuar con otros usuarios, si tienes dudas sobre como hacerlo esta es tu sección./, | ||
moreDetails: /Más detalles/ | ||
}, | ||
{ | ||
description: /Tenemos un modo para poder ver todas tus estadísticas para cada modo de juego, si tienes alguna duda esta es tu sección/, | ||
moreDetails: /Más detalles/ | ||
} | ||
]; | ||
|
||
categoriesAndDescriptions.forEach(({ description, moreDetails }) => { | ||
const descriptionElement = getByText(description); | ||
const moreDetailsLinks = getAllByText(moreDetails); | ||
|
||
expect(descriptionElement).toBeInTheDocument(); | ||
expect(moreDetailsLinks.length).toBeGreaterThanOrEqual(1); | ||
}); | ||
}); | ||
}); |
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,24 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Heading} from '@chakra-ui/react'; | ||
import Nav from '../../components/Nav/Nav'; | ||
import Footer from '../../components/Footer/Footer'; | ||
|
||
const AyudaEstadisticas = () => { | ||
|
||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<Nav /> | ||
<Heading as="h2">{t('pages.helpStats.title')}</Heading> | ||
<p>{t('pages.helpStats.description')} | ||
</p> | ||
<Heading as="h2">{t('pages.helpStats.title2')}</Heading> | ||
<p>{t('pages.helpStats.description2')}</p> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
export default AyudaEstadisticas; |
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,38 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
import AyudaEstadisticas from './AyudaEstadisticas'; | ||
import { I18nextProvider } from "react-i18next"; | ||
import i18n from "../../i18n.js"; | ||
|
||
describe('AyudaEstadisticas Component', () => { | ||
|
||
const renderComponentWithRouter = () => { | ||
return render( | ||
<I18nextProvider i18n={i18n}> | ||
<Router> | ||
<AyudaEstadisticas /> | ||
</Router> | ||
</I18nextProvider> | ||
); | ||
}; | ||
|
||
it('renders component without crashing', () => { | ||
renderComponentWithRouter(); | ||
}); | ||
|
||
const checkDescription = (description) => { | ||
const { getByText } = renderComponentWithRouter(); | ||
const descriptionElement = getByText(description); | ||
expect(descriptionElement).toBeInTheDocument(); | ||
}; | ||
|
||
it('renders the correct title and description', () => { | ||
checkDescription(/Nuestra aplicación cuenta con un sistema de estadísticas en la que podrás ver tus estadísticas en los distintos modos de juego, y a su vez también puedes ver las estadisticas de otros usuarios./i); | ||
}); | ||
|
||
it('renders the correct second title and description', () => { | ||
checkDescription(/Nuestra aplicación también cuenta con un sistema de ranking donde podrás ver los usuarios con las mejores puntuaciones, y filtrarlo por distintos parámetros./i); | ||
}); | ||
}); | ||
|
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,27 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Heading} from '@chakra-ui/react'; | ||
import Nav from '../../components/Nav/Nav'; | ||
import Footer from '../../components/Footer/Footer'; | ||
const AyudaJuego = () => { | ||
|
||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<> | ||
<Nav /> | ||
<Heading as="h1">{t('pages.helpGame.title')}</Heading> | ||
<p>{t('pages.helpGame.description')} | ||
</p> | ||
<Heading as="h2" size="md">{t('pages.helpGame.classic')}</Heading> | ||
<p>{t('pages.helpGame.classicDescription')}</p> | ||
<Heading as="h2" size="md">{t('pages.helpGame.sabios')}</Heading> | ||
<p>{t('pages.helpGame.sabiosDescription')}</p> | ||
<Heading as="h2" size="md">{t('pages.helpGame.calculator')}</Heading> | ||
<p>{t('pages.helpGame.calculatorDescription')}</p> | ||
<Footer /> | ||
</> | ||
); | ||
}; | ||
|
||
export default AyudaJuego; |
Oops, something went wrong.