mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
B104 — Wizard: label genérica "Pular" nas ações encadeadas
Substitui as quatro labels longas de skip (votos, tendência, sinal, liderança) por uma constante compartilhada WIZARD_CHAIN_SKIP_LABEL. Resolvers e condições de exibição permanecem intactos (B96/B98). Closes #131 Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
da7c813a55
commit
2fa6e7298a
11 changed files with 34 additions and 28 deletions
|
|
@ -32,7 +32,7 @@ export const WIZARD_MUNICIPALITY_SEARCH_EMPTY = 'Nenhum município encontrado.'
|
|||
|
||||
export const WIZARD_VOTES_SAVED_MESSAGE = 'Votos estimados atualizados.' as const
|
||||
|
||||
const WIZARD_VOTES_SKIP_LABEL = 'Pular ajuste de votos →' as const
|
||||
export const WIZARD_CHAIN_SKIP_LABEL = 'Pular' as const
|
||||
|
||||
export const WIZARD_VOTES_FINAL_CTA_LABEL = 'Salvar estimativas →' as const
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ export const resolveWizardVotesSkip = (
|
|||
): WizardVotesSkipAction | undefined =>
|
||||
shouldShowWizardVotesSkip(entryAction)
|
||||
? {
|
||||
label: WIZARD_VOTES_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: wizardChainContinueHref(
|
||||
resolveWizardChainEntry(entryAction, 'update-votes'),
|
||||
'update-votes',
|
||||
|
|
@ -77,8 +77,6 @@ export const WIZARD_LEADERSHIP_FORM_CREATE_TITLE = 'Nova liderança' as const
|
|||
|
||||
export const WIZARD_LEADERSHIP_FORM_EDIT_TITLE = 'Atualizar liderança' as const
|
||||
|
||||
export const WIZARD_LEADERSHIP_SKIP_LABEL = 'Pular atualização de liderança →' as const
|
||||
|
||||
export const WIZARD_LEADERSHIP_CONTINUE_LABEL = 'Continuar' as const
|
||||
|
||||
export const WIZARD_LEADERSHIP_ADD_TILE_LABEL = 'Adicionar liderança' as const
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import { politicalTrendStatuses, type PoliticalTrendStatusValue } from '@/lib/schemas/municipality'
|
||||
import {
|
||||
municipalitySignalTypeLabels,
|
||||
|
|
@ -12,8 +13,6 @@ const politicalTrendDisplayLabels: Record<PoliticalTrendStatusValue, string> = {
|
|||
desfavoravel: 'Desfavorável',
|
||||
}
|
||||
|
||||
export const WIZARD_TREND_SKIP_LABEL = 'Pular mudança de tendência →' as const
|
||||
|
||||
export const WIZARD_TREND_SAVE_LABEL = 'Salvar' as const
|
||||
|
||||
export const WIZARD_TREND_CLEAR_LABEL = 'Limpar' as const
|
||||
|
|
@ -73,7 +72,7 @@ export const resolveWizardTrendSkip = (
|
|||
): WizardTrendSkipAction | undefined =>
|
||||
shouldShowWizardTrendSkip(entryAction)
|
||||
? {
|
||||
label: WIZARD_TREND_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: wizardChainContinueHref(
|
||||
resolveWizardChainEntry(entryAction, 'change-trend'),
|
||||
'change-trend',
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
||||
import { WIZARD_LEADERSHIP_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import type { SupportStatus } from '@/lib/schemas/leadership'
|
||||
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ export const resolveWizardLeadershipSkip = (
|
|||
): WizardLeadershipSkipAction | undefined =>
|
||||
showLeadershipWizardSkip(entryAction)
|
||||
? {
|
||||
label: WIZARD_LEADERSHIP_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: wizardChainContinueHref(
|
||||
resolveWizardChainEntry(entryAction, 'update-leadership'),
|
||||
'update-leadership',
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
||||
|
||||
export const WIZARD_SIGNAL_TYPE_STEP_TITLE = 'Que tipo de sinal?' as const
|
||||
|
||||
export const WIZARD_SIGNAL_BODY_STEP_TITLE_PREFIX = 'Detalhar sinal' as const
|
||||
|
||||
export const WIZARD_SIGNAL_SKIP_LABEL = 'Pular registro de sinal' as const
|
||||
|
||||
export const WIZARD_SIGNAL_SAVE_LABEL = 'Salvar' as const
|
||||
|
||||
export const WIZARD_SIGNAL_SAVED_MESSAGE = 'Sinal registrado.' as const
|
||||
|
|
@ -26,7 +25,7 @@ export const resolveWizardSignalSkip = (
|
|||
): WizardSignalSkipAction | undefined =>
|
||||
shouldShowWizardSignalSkip(entryAction)
|
||||
? {
|
||||
label: WIZARD_SIGNAL_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: wizardChainContinueHref(
|
||||
resolveWizardChainEntry(entryAction, 'register-signal'),
|
||||
'register-signal',
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ test.describe('Wizard — registrar sinal (B63)', () => {
|
|||
await expect(page.getByRole('heading', { name: 'Que tipo de sinal?' })).toBeVisible({
|
||||
timeout: 15000,
|
||||
})
|
||||
await expect(page.getByRole('link', { name: 'Pular registro de sinal' })).toHaveCount(0)
|
||||
await expect(page.getByRole('link', { name: 'Pular' })).toHaveCount(0)
|
||||
|
||||
await page.getByRole('link', { name: /Invasão/i }).click()
|
||||
await page.waitForURL(/signalType=invasao/)
|
||||
|
|
@ -387,7 +387,7 @@ test.describe('Wizard — registrar sinal (B63)', () => {
|
|||
`/campanha/acoes/registrar-sinal?municipio=${municipality.slug}&entry=update-votes`,
|
||||
)
|
||||
|
||||
const skip = page.getByRole('link', { name: 'Pular registro de sinal' })
|
||||
const skip = page.getByRole('link', { name: 'Pular' })
|
||||
await expect(skip).toBeVisible({ timeout: 15000 })
|
||||
await expect(skip).toHaveAttribute(
|
||||
'href',
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ describe('CampaignMobileTopBar', () => {
|
|||
previousHref: '/campanha/acoes/atualizar-votos?municipio=cairu',
|
||||
dismissHref: '/campanha',
|
||||
skip: {
|
||||
label: 'Pular registro de sinal',
|
||||
label: 'Pular',
|
||||
href: '/campanha/acoes/mudar-tendencia?municipio=cairu',
|
||||
},
|
||||
})
|
||||
|
||||
expect(screen.getByRole('link', { name: 'Pular registro de sinal' }).getAttribute('href')).toBe(
|
||||
expect(screen.getByRole('link', { name: 'Pular' }).getAttribute('href')).toBe(
|
||||
'/campanha/acoes/mudar-tendencia?municipio=cairu',
|
||||
)
|
||||
expect(screen.queryByRole('link', { name: 'Sair da ação' })).toBeNull()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||
import {
|
||||
resolveWizardVotesSkip,
|
||||
WIZARD_CHAIN_SKIP_LABEL,
|
||||
WIZARD_DISMISS_ARIA_LABEL,
|
||||
wizardFlowChromeAriaLabel,
|
||||
wizardFlowTitleForSlug,
|
||||
|
|
@ -19,4 +22,14 @@ describe('campaignWizardCopy', () => {
|
|||
expect(wizardMunicipalityChromeAriaLabel('Cairu')).toBe('Município em atualização: Cairu')
|
||||
expect(WIZARD_DISMISS_ARIA_LABEL).toBe('Sair da ação')
|
||||
})
|
||||
|
||||
it('uses the shared chain skip label for embedded vote adjustments', () => {
|
||||
expect(WIZARD_CHAIN_SKIP_LABEL).toBe('Pular')
|
||||
expect(resolveWizardVotesSkip(undefined, 'cairu')).toBeUndefined()
|
||||
expect(resolveWizardVotesSkip('update-votes', 'cairu')).toBeUndefined()
|
||||
expect(resolveWizardVotesSkip('change-trend', 'cairu')).toEqual({
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=change-trend`,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import {
|
||||
politicalTrendWizardMeta,
|
||||
politicalTrendWizardMetaByStatus,
|
||||
|
|
@ -12,7 +13,6 @@ import {
|
|||
resolveWizardTrendSkip,
|
||||
selectablePoliticalTrendStatuses,
|
||||
shouldShowWizardTrendSkip,
|
||||
WIZARD_TREND_SKIP_LABEL,
|
||||
WIZARD_TREND_UNREGISTERED_TITLE,
|
||||
wizardTrendChoiceStepTitle,
|
||||
} from '@/lib/politicalTrendWizardUi'
|
||||
|
|
@ -47,7 +47,7 @@ describe('politicalTrendWizardUi', () => {
|
|||
expect(shouldShowWizardTrendSkip('update-votes')).toBe(true)
|
||||
expect(shouldShowWizardTrendSkip('register-signal')).toBe(true)
|
||||
expect(resolveWizardTrendSkip('update-votes', 'cairu')).toEqual({
|
||||
label: WIZARD_TREND_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: `${CAMPAIGN_ACTIONS_HOME}/registrar-sinal?municipio=cairu&entry=update-votes`,
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ describe('WizardExpectedVotesStep', () => {
|
|||
it('shows skip to the next chain step when votes is chained', () => {
|
||||
renderVotesStep({ ...defaultProps, entryAction: 'register-signal' })
|
||||
|
||||
const skip = screen.getByRole('link', { name: /Pular ajuste de votos/i })
|
||||
const skip = screen.getByRole('link', { name: /^Pular$/i })
|
||||
expect(skip.getAttribute('href')).toBe(
|
||||
`${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=register-signal`,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { CAMPAIGN_HOME } from '@/lib/campaignPaths'
|
||||
import { WIZARD_LEADERSHIP_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import {
|
||||
resolveWizardLeadershipSkip,
|
||||
showLeadershipWizardSkip,
|
||||
|
|
@ -30,7 +30,7 @@ describe('resolveWizardLeadershipSkip', () => {
|
|||
it('points skip to Início when leadership is the last chained step', () => {
|
||||
// In the v1 matrix, leadership is always the final chained elo.
|
||||
expect(resolveWizardLeadershipSkip('update-votes', 'cairu')).toEqual({
|
||||
label: WIZARD_LEADERSHIP_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: CAMPAIGN_HOME,
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||
import {
|
||||
municipalitySignalTypeMeta,
|
||||
municipalitySignalTypeMetaByType,
|
||||
} from '@/lib/municipalitySignalTypeMeta'
|
||||
import { municipalitySignalTypes } from '@/lib/schemas/municipalityUpdate'
|
||||
import {
|
||||
resolveWizardSignalSkip,
|
||||
shouldShowWizardSignalSkip,
|
||||
WIZARD_SIGNAL_SKIP_LABEL,
|
||||
} from '@/lib/wizardSignalUi'
|
||||
import { resolveWizardSignalSkip, shouldShowWizardSignalSkip } from '@/lib/wizardSignalUi'
|
||||
|
||||
describe('wizardSignalUi', () => {
|
||||
it('hides skip for standalone register-signal entry', () => {
|
||||
|
|
@ -24,11 +21,11 @@ describe('wizardSignalUi', () => {
|
|||
expect(shouldShowWizardSignalSkip('update-votes')).toBe(true)
|
||||
expect(shouldShowWizardSignalSkip('change-trend')).toBe(true)
|
||||
expect(resolveWizardSignalSkip('update-votes', 'cairu')).toEqual({
|
||||
label: WIZARD_SIGNAL_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=update-votes`,
|
||||
})
|
||||
expect(resolveWizardSignalSkip('change-trend', 'cairu')).toEqual({
|
||||
label: WIZARD_SIGNAL_SKIP_LABEL,
|
||||
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-votos?municipio=cairu&entry=change-trend`,
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue