feat(controller): dialog set vinto con transizione automatica al set successivo
Quando una squadra raggiunge il punteggio di vittoria (25 con +2 di scarto, 15 nel set decisivo), il controller mostra un dialog "SET VINTO" con il nome della squadra vincente. Alla conferma: invia l'azione nuovoSet (incrementa il set, azzera punti, striscia, storico servizio e formazioni) e apre automaticamente il dialog di configurazione per inserire le formazioni del set successivo.
This commit is contained in:
@@ -231,6 +231,52 @@ describe('Game Logic (gameState.js)', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// =============================================
|
||||
// NUOVO SET (nuovoSet)
|
||||
// =============================================
|
||||
describe('nuovoSet', () => {
|
||||
it('dovrebbe incrementare il set della squadra vincente', () => {
|
||||
state.sp.punt.home = 25
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'home' })
|
||||
expect(s.sp.set.home).toBe(1)
|
||||
expect(s.sp.set.guest).toBe(0)
|
||||
})
|
||||
|
||||
it('dovrebbe azzerare i punti', () => {
|
||||
state.sp.punt.home = 25
|
||||
state.sp.punt.guest = 10
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'home' })
|
||||
expect(s.sp.punt.home).toBe(0)
|
||||
expect(s.sp.punt.guest).toBe(0)
|
||||
})
|
||||
|
||||
it('dovrebbe resettare la striscia', () => {
|
||||
state.sp.punt.home = 25
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'home' })
|
||||
expect(s.sp.striscia).toEqual({ home: [0], guest: [0] })
|
||||
})
|
||||
|
||||
it('dovrebbe resettare lo storico servizio', () => {
|
||||
state.sp.storicoServizio = [{ servHome: true, cambioPalla: false }]
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'home' })
|
||||
expect(s.sp.storicoServizio).toEqual([])
|
||||
})
|
||||
|
||||
it('dovrebbe resettare le formazioni', () => {
|
||||
state.sp.form.home = ['7', '8', '9', '10', '11', '12']
|
||||
state.sp.form.guest = ['7', '8', '9', '10', '11', '12']
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'home' })
|
||||
expect(s.sp.form.home).toEqual(['1', '2', '3', '4', '5', '6'])
|
||||
expect(s.sp.form.guest).toEqual(['1', '2', '3', '4', '5', '6'])
|
||||
})
|
||||
|
||||
it('dovrebbe ignorare team non valido', () => {
|
||||
const s = applyAction(state, { type: 'nuovoSet', team: 'invalid' })
|
||||
expect(s.sp.set.home).toBe(0)
|
||||
expect(s.sp.set.guest).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
// =============================================
|
||||
// CAMBIO PALLA (cambiaPalla)
|
||||
// =============================================
|
||||
|
||||
Reference in New Issue
Block a user