Skip to content

feat: add PIS/PASEP support to example demo - #60

Merged
mariohmol merged 3 commits into
masterfrom
feat/pispasep
Apr 14, 2026
Merged

mariohmol merged 3 commits into
masterfrom
feat/pispasep

Conversation

@mariohmol

Copy link
Copy Markdown
Owner

Summary

  • js-brasil already implements PIS/PASEP validation, masking, and formatting under the pispasep key
  • Adds pispasep to the FORMATS list in the example app so it appears in both the masked-input table and the static valid/invalid table
  • Adds a valid example value (123.45678.91-9) and an invalid one (12345678918) to the fixture data

Closes mariohmol/ng-brazil#3

Test plan

  • Visit http://test.counbo.com/react-brazil/ and confirm a pispasep row appears in both tables
  • Confirm the masked input formats correctly as ###.#####.##-#
  • Confirm the valid value shows ✓ and the invalid value shows ✗

🤖 Generated with Claude Code

mariohmol and others added 3 commits April 14, 2026 02:14
js-brasil already exposes pispasep in validateBr/maskBr/utilsBr.MASKS.
Wire it into the example app's FORMATS list and add valid/invalid
fixture values so it appears in both the masked-input and static tables.

Closes mariohmol/ng-brazil#3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add GENERATORS in utils.js with random valid-value generators for all
  formats (CPF, CNPJ, CEP, RG, telefone, placa, renavam, titulo, time,
  currency, PIS/PASEP) using the same check-digit algorithms as js-brasil
- Add Regenerate button in App that fills all masked inputs with fresh
  random valid values on each click (remounts rows via epoch key)
- Fix renavam: was missing from DATA/DATARAW/DATAERROR, so the input
  started empty and never validated
- Fix titulo: replace non-validating example value with a valid one
  computed via the create_titulo_atual algorithm

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two root causes:
- ValidatedRow.state.value was initialised with the raw generator output
  (e.g. '0658' for time) but validators like validate_time require the
  formatted value ('06:58'). Fix: initialise state.value via maskBr so
  it always matches what the masked input displays.
- Time generator was returning raw 4-digit string ('HHMM') instead of
  the 'HH:MM' format validate_time requires. Fix: include the colon.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mariohmol
mariohmol merged commit 2cc154a into master Apr 14, 2026
3 checks passed
@mariohmol mariohmol mentioned this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NIT

1 participant