Simulador: os campos numéricos aceitam «25.000», «1 500» e «1500,50»
tests / ci (push) Canceled after 0s

O campo numérico do navegador segue a língua do navegador: «25.000» era
lido como 25 e a vírgula decimal podia ser recusada, pelo que o investidor
via o valor mudar ou não conseguia escrever. Os campos de montantes do
simulador, do plano de negócio e do orçamento inicial passam a usar um
campo de texto decimal que lê os números como se escrevem em Moçambique,
mostra «Lido como …» quando reinterpreta e deixa o texto inválido chegar à
validação, que o explica.

Os campos inteiros (horizonte, prazo de entrega, vida útil, mês económico)
deixam de saltar para 1 quando se apaga para reescrever; se o valor escrito
não for aceite, ao sair do campo volta o valor em vigor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jM
This commit is contained in:
Claude
2026-12-04 23:01:57 +02:00
committed by nala
parent 52176edc21
commit 4745331ebd
28 changed files with 559 additions and 196 deletions
@@ -15,6 +15,11 @@ import {
serializeBusinessPlanSnapshot,
restoreBusinessPlanSnapshot,
} from '../../resources/js/lib/business-financial-plan.ts';
import {
decimalInputModule,
isNumberField,
typeNumber,
} from './helpers/decimal-input.mjs';
void test('one startup editor retains all rows and persists an edit without duplicating controls or changing reconciliation', () => {
const source = fs.readFileSync(
@@ -39,17 +44,19 @@ void test('one startup editor retains all rows and persists an edit without dupl
? report
: name === '@/lib/irpc-plan-scenario'
? irpcScenario
: name === './investment-report-tables'
? { InvestmentReportTables: () => null }
: name === '@/lib/financial-plan-warnings'
? warnings
: name === '@/lib/annual-example-report'
? annual
: name === './business-plan-warnings'
? { BusinessPlanWarnings: () => null }
: name === './startup-asset-requirements'
? { StartupAssetRequirements: () => null }
: require(name),
: name === './investment-report-tables'
? { InvestmentReportTables: () => null }
: name === '@/lib/financial-plan-warnings'
? warnings
: name === '@/lib/annual-example-report'
? annual
: name === './business-plan-warnings'
? { BusinessPlanWarnings: () => null }
: name === './startup-asset-requirements'
? { StartupAssetRequirements: () => null }
: name === '@/components/decimal-input'
? decimalInputModule
: require(name),
module,
module.exports,
);
@@ -80,9 +87,7 @@ void test('one startup editor retains all rows and persists an edit without dupl
'Montante de arranque 1',
),
);
nodes(label)
.find((node) => node.type === 'input')
.props.onChange({ target: { value: '100.25' } });
typeNumber(nodes(label).find(isNumberField), '100.25');
plan = restoreBusinessPlanSnapshot(serializeBusinessPlanSnapshot(plan));
assert.equal(plan.reportAssumptions.startupExpenses[0].amount, '100.25');
assert.match(renderToStaticMarkup(render()), /value="100.25"/);