This file contains hidden or 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
| import { resultadoDeMano, carta, Palo, ResultadoMano, cartaATexto } from './constants' | |
| const { ESPADAS, BASTOS, OROS, COPAS } = Palo | |
| const { GANADOR, PERDEDOR, EMPATE } = ResultadoMano | |
| describe('modelo del truco', () => { | |
| describe('resultadoDeMano(carta, otra)', () => { | |
| // generador de tests |
This file contains hidden or 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
| import React from 'react' | |
| import Ronda from '../containers/Ronda' | |
| import Puntaje from '../containers/Puntaje' | |
| import Oponente from '../containers/Oponente' | |
| import './Juego.css' | |
| export default function Juego({ onIniciarJuego, onJugarCarta }) { | |
| return ( |
This file contains hidden or 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
| import { connect } from 'react-redux' | |
| import Oponente from '../components/Oponente' | |
| import { jugarCarta } from '../actions/juego' | |
| const mapActionsToProps = dispatch => ({ | |
| jugarCarta: carta => dispatch(jugarCarta(carta)) | |
| }) | |
| const mapStateToProps = state => ({ |
This file contains hidden or 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
| import React from 'react' | |
| import { Turno } from '../model/constants' | |
| export default class Oponente extends React.Component { | |
| simularJugada() { | |
| const { turno, cartas, jugarCarta } = this.props | |
| if (turno === Turno.ELLOS) { | |
| setTimeout(() => { | |
| const carta = cartas.find(c => c.jugada === undefined) |
This file contains hidden or 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
| describe('marcar jugada', () => { | |
| it('marca la carta jugada entre las nuestras', () => { | |
| const carta = { numero: '2', palo: 'bastos' } | |
| const state = { | |
| ronda: { | |
| turno: Turno.NOSOTROS, | |
| manos: [{}, {}, {}], | |
| cartas: { | |
| nosotros: [ |
This file contains hidden or 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
| describe('jugarCarta()', () => { | |
| it('debe jugar la carta en la PRIMERA MANO si todavía nadie jugó', () => { | |
| const state = { | |
| ronda: { | |
| manos: [{}, {}, {}] | |
| } | |
| } | |
| const carta = { numero: '2', palo: 'bastos' } | |
| const nuevoState = juego(state, jugarCarta(carta)) |
This file contains hidden or 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
| .manoConTurno { | |
| display: flex; | |
| flex-direction: row; | |
| } | |
| .manoConTurno .turnoActual { | |
| width: 32px; | |
| margin-right: 1em; | |
| } | |
| .manoConTurno .turnoActual.habilitado { |
This file contains hidden or 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
| import React from 'react' | |
| import './ManoConTurno.css' | |
| const ManoConTurno = ({ actual, children }) => ( | |
| <div className="manoConTurno"> | |
| <div className={`turnoActual ${actual && "habilitado"}`} /> | |
| {children} | |
| </div> | |
| ) |
This file contains hidden or 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
| import React from 'react' | |
| import Mano from './Mano.jsx' | |
| import Mesa from './Mesa.jsx' | |
| import ManoConTurno from './ManoConTurno.jsx' | |
| import { Turno } from '../model/constants' | |
| const noRonda = { | |
| cartas: { nosotros: [], ellos: [] }, |
This file contains hidden or 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
| import React from 'react' | |
| import Ronda from '../containers/Ronda' | |
| import Puntaje from '../containers/Puntaje' | |
| import { Palo, ResultadoMano } from '../model/constants' | |
| import './Juego.css' | |
| export default function Juego({ onIniciarJuego }) { |