mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-28 07:33:05 +00:00
Merge pull request #137 from fsolla/cursor/pool-i131-803d9700-95db
B104 — Wizard: label genérica "Pular" nas ações encadeadas
This commit is contained in:
commit
313a041d5b
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
|
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
|
export const WIZARD_VOTES_FINAL_CTA_LABEL = 'Salvar estimativas →' as const
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ export const resolveWizardVotesSkip = (
|
||||||
): WizardVotesSkipAction | undefined =>
|
): WizardVotesSkipAction | undefined =>
|
||||||
shouldShowWizardVotesSkip(entryAction)
|
shouldShowWizardVotesSkip(entryAction)
|
||||||
? {
|
? {
|
||||||
label: WIZARD_VOTES_SKIP_LABEL,
|
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||||
href: wizardChainContinueHref(
|
href: wizardChainContinueHref(
|
||||||
resolveWizardChainEntry(entryAction, 'update-votes'),
|
resolveWizardChainEntry(entryAction, 'update-votes'),
|
||||||
'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_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_CONTINUE_LABEL = 'Continuar' as const
|
||||||
|
|
||||||
export const WIZARD_LEADERSHIP_ADD_TILE_LABEL = 'Adicionar liderança' 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 type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
||||||
|
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||||
import { politicalTrendStatuses, type PoliticalTrendStatusValue } from '@/lib/schemas/municipality'
|
import { politicalTrendStatuses, type PoliticalTrendStatusValue } from '@/lib/schemas/municipality'
|
||||||
import {
|
import {
|
||||||
municipalitySignalTypeLabels,
|
municipalitySignalTypeLabels,
|
||||||
|
|
@ -12,8 +13,6 @@ const politicalTrendDisplayLabels: Record<PoliticalTrendStatusValue, string> = {
|
||||||
desfavoravel: 'Desfavorável',
|
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_SAVE_LABEL = 'Salvar' as const
|
||||||
|
|
||||||
export const WIZARD_TREND_CLEAR_LABEL = 'Limpar' as const
|
export const WIZARD_TREND_CLEAR_LABEL = 'Limpar' as const
|
||||||
|
|
@ -73,7 +72,7 @@ export const resolveWizardTrendSkip = (
|
||||||
): WizardTrendSkipAction | undefined =>
|
): WizardTrendSkipAction | undefined =>
|
||||||
shouldShowWizardTrendSkip(entryAction)
|
shouldShowWizardTrendSkip(entryAction)
|
||||||
? {
|
? {
|
||||||
label: WIZARD_TREND_SKIP_LABEL,
|
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||||
href: wizardChainContinueHref(
|
href: wizardChainContinueHref(
|
||||||
resolveWizardChainEntry(entryAction, 'change-trend'),
|
resolveWizardChainEntry(entryAction, 'change-trend'),
|
||||||
'change-trend',
|
'change-trend',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
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 type { SupportStatus } from '@/lib/schemas/leadership'
|
||||||
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ export const resolveWizardLeadershipSkip = (
|
||||||
): WizardLeadershipSkipAction | undefined =>
|
): WizardLeadershipSkipAction | undefined =>
|
||||||
showLeadershipWizardSkip(entryAction)
|
showLeadershipWizardSkip(entryAction)
|
||||||
? {
|
? {
|
||||||
label: WIZARD_LEADERSHIP_SKIP_LABEL,
|
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||||
href: wizardChainContinueHref(
|
href: wizardChainContinueHref(
|
||||||
resolveWizardChainEntry(entryAction, 'update-leadership'),
|
resolveWizardChainEntry(entryAction, 'update-leadership'),
|
||||||
'update-leadership',
|
'update-leadership',
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
import type { CampaignWizardActionId } from '@/lib/campaignActionRoutes'
|
||||||
|
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||||
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
import { resolveWizardChainEntry, wizardChainContinueHref } from '@/lib/wizardActionChain'
|
||||||
|
|
||||||
export const WIZARD_SIGNAL_TYPE_STEP_TITLE = 'Que tipo de sinal?' as const
|
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_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_SAVE_LABEL = 'Salvar' as const
|
||||||
|
|
||||||
export const WIZARD_SIGNAL_SAVED_MESSAGE = 'Sinal registrado.' as const
|
export const WIZARD_SIGNAL_SAVED_MESSAGE = 'Sinal registrado.' as const
|
||||||
|
|
@ -26,7 +25,7 @@ export const resolveWizardSignalSkip = (
|
||||||
): WizardSignalSkipAction | undefined =>
|
): WizardSignalSkipAction | undefined =>
|
||||||
shouldShowWizardSignalSkip(entryAction)
|
shouldShowWizardSignalSkip(entryAction)
|
||||||
? {
|
? {
|
||||||
label: WIZARD_SIGNAL_SKIP_LABEL,
|
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||||
href: wizardChainContinueHref(
|
href: wizardChainContinueHref(
|
||||||
resolveWizardChainEntry(entryAction, 'register-signal'),
|
resolveWizardChainEntry(entryAction, 'register-signal'),
|
||||||
'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({
|
await expect(page.getByRole('heading', { name: 'Que tipo de sinal?' })).toBeVisible({
|
||||||
timeout: 15000,
|
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.getByRole('link', { name: /Invasão/i }).click()
|
||||||
await page.waitForURL(/signalType=invasao/)
|
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`,
|
`/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).toBeVisible({ timeout: 15000 })
|
||||||
await expect(skip).toHaveAttribute(
|
await expect(skip).toHaveAttribute(
|
||||||
'href',
|
'href',
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,12 @@ describe('CampaignMobileTopBar', () => {
|
||||||
previousHref: '/campanha/acoes/atualizar-votos?municipio=cairu',
|
previousHref: '/campanha/acoes/atualizar-votos?municipio=cairu',
|
||||||
dismissHref: '/campanha',
|
dismissHref: '/campanha',
|
||||||
skip: {
|
skip: {
|
||||||
label: 'Pular registro de sinal',
|
label: 'Pular',
|
||||||
href: '/campanha/acoes/mudar-tendencia?municipio=cairu',
|
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',
|
'/campanha/acoes/mudar-tendencia?municipio=cairu',
|
||||||
)
|
)
|
||||||
expect(screen.queryByRole('link', { name: 'Sair da ação' })).toBeNull()
|
expect(screen.queryByRole('link', { name: 'Sair da ação' })).toBeNull()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||||
import {
|
import {
|
||||||
|
resolveWizardVotesSkip,
|
||||||
|
WIZARD_CHAIN_SKIP_LABEL,
|
||||||
WIZARD_DISMISS_ARIA_LABEL,
|
WIZARD_DISMISS_ARIA_LABEL,
|
||||||
wizardFlowChromeAriaLabel,
|
wizardFlowChromeAriaLabel,
|
||||||
wizardFlowTitleForSlug,
|
wizardFlowTitleForSlug,
|
||||||
|
|
@ -19,4 +22,14 @@ describe('campaignWizardCopy', () => {
|
||||||
expect(wizardMunicipalityChromeAriaLabel('Cairu')).toBe('Município em atualização: Cairu')
|
expect(wizardMunicipalityChromeAriaLabel('Cairu')).toBe('Município em atualização: Cairu')
|
||||||
expect(WIZARD_DISMISS_ARIA_LABEL).toBe('Sair da ação')
|
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 { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||||
|
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||||
import {
|
import {
|
||||||
politicalTrendWizardMeta,
|
politicalTrendWizardMeta,
|
||||||
politicalTrendWizardMetaByStatus,
|
politicalTrendWizardMetaByStatus,
|
||||||
|
|
@ -12,7 +13,6 @@ import {
|
||||||
resolveWizardTrendSkip,
|
resolveWizardTrendSkip,
|
||||||
selectablePoliticalTrendStatuses,
|
selectablePoliticalTrendStatuses,
|
||||||
shouldShowWizardTrendSkip,
|
shouldShowWizardTrendSkip,
|
||||||
WIZARD_TREND_SKIP_LABEL,
|
|
||||||
WIZARD_TREND_UNREGISTERED_TITLE,
|
WIZARD_TREND_UNREGISTERED_TITLE,
|
||||||
wizardTrendChoiceStepTitle,
|
wizardTrendChoiceStepTitle,
|
||||||
} from '@/lib/politicalTrendWizardUi'
|
} from '@/lib/politicalTrendWizardUi'
|
||||||
|
|
@ -47,7 +47,7 @@ describe('politicalTrendWizardUi', () => {
|
||||||
expect(shouldShowWizardTrendSkip('update-votes')).toBe(true)
|
expect(shouldShowWizardTrendSkip('update-votes')).toBe(true)
|
||||||
expect(shouldShowWizardTrendSkip('register-signal')).toBe(true)
|
expect(shouldShowWizardTrendSkip('register-signal')).toBe(true)
|
||||||
expect(resolveWizardTrendSkip('update-votes', 'cairu')).toEqual({
|
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`,
|
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', () => {
|
it('shows skip to the next chain step when votes is chained', () => {
|
||||||
renderVotesStep({ ...defaultProps, entryAction: 'register-signal' })
|
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(
|
expect(skip.getAttribute('href')).toBe(
|
||||||
`${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=register-signal`,
|
`${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=register-signal`,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { CAMPAIGN_HOME } from '@/lib/campaignPaths'
|
import { CAMPAIGN_HOME } from '@/lib/campaignPaths'
|
||||||
import { WIZARD_LEADERSHIP_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||||
import {
|
import {
|
||||||
resolveWizardLeadershipSkip,
|
resolveWizardLeadershipSkip,
|
||||||
showLeadershipWizardSkip,
|
showLeadershipWizardSkip,
|
||||||
|
|
@ -30,7 +30,7 @@ describe('resolveWizardLeadershipSkip', () => {
|
||||||
it('points skip to Início when leadership is the last chained step', () => {
|
it('points skip to Início when leadership is the last chained step', () => {
|
||||||
// In the v1 matrix, leadership is always the final chained elo.
|
// In the v1 matrix, leadership is always the final chained elo.
|
||||||
expect(resolveWizardLeadershipSkip('update-votes', 'cairu')).toEqual({
|
expect(resolveWizardLeadershipSkip('update-votes', 'cairu')).toEqual({
|
||||||
label: WIZARD_LEADERSHIP_SKIP_LABEL,
|
label: WIZARD_CHAIN_SKIP_LABEL,
|
||||||
href: CAMPAIGN_HOME,
|
href: CAMPAIGN_HOME,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
import { describe, expect, it } from 'vitest'
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
import { CAMPAIGN_ACTIONS_HOME } from '@/lib/campaignActionRoutes'
|
||||||
|
import { WIZARD_CHAIN_SKIP_LABEL } from '@/lib/campaignWizardCopy'
|
||||||
import {
|
import {
|
||||||
municipalitySignalTypeMeta,
|
municipalitySignalTypeMeta,
|
||||||
municipalitySignalTypeMetaByType,
|
municipalitySignalTypeMetaByType,
|
||||||
} from '@/lib/municipalitySignalTypeMeta'
|
} from '@/lib/municipalitySignalTypeMeta'
|
||||||
import { municipalitySignalTypes } from '@/lib/schemas/municipalityUpdate'
|
import { municipalitySignalTypes } from '@/lib/schemas/municipalityUpdate'
|
||||||
import {
|
import { resolveWizardSignalSkip, shouldShowWizardSignalSkip } from '@/lib/wizardSignalUi'
|
||||||
resolveWizardSignalSkip,
|
|
||||||
shouldShowWizardSignalSkip,
|
|
||||||
WIZARD_SIGNAL_SKIP_LABEL,
|
|
||||||
} from '@/lib/wizardSignalUi'
|
|
||||||
|
|
||||||
describe('wizardSignalUi', () => {
|
describe('wizardSignalUi', () => {
|
||||||
it('hides skip for standalone register-signal entry', () => {
|
it('hides skip for standalone register-signal entry', () => {
|
||||||
|
|
@ -24,11 +21,11 @@ describe('wizardSignalUi', () => {
|
||||||
expect(shouldShowWizardSignalSkip('update-votes')).toBe(true)
|
expect(shouldShowWizardSignalSkip('update-votes')).toBe(true)
|
||||||
expect(shouldShowWizardSignalSkip('change-trend')).toBe(true)
|
expect(shouldShowWizardSignalSkip('change-trend')).toBe(true)
|
||||||
expect(resolveWizardSignalSkip('update-votes', 'cairu')).toEqual({
|
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`,
|
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-lideranca?municipio=cairu&entry=update-votes`,
|
||||||
})
|
})
|
||||||
expect(resolveWizardSignalSkip('change-trend', 'cairu')).toEqual({
|
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`,
|
href: `${CAMPAIGN_ACTIONS_HOME}/atualizar-votos?municipio=cairu&entry=change-trend`,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue