Skip to content

test(widgets): IbanTextFormatter + IbanInputFormatter (+9 tests)#366

Merged
TaprootFreak merged 1 commit into
developfrom
test/iban-formatters
May 15, 2026
Merged

test(widgets): IbanTextFormatter + IbanInputFormatter (+9 tests)#366
TaprootFreak merged 1 commit into
developfrom
test/iban-formatters

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 42 of the coverage push. Pure-function tests for the two IBAN formatters that drive the bank-account input field.

Cases

Target Cases
`IbanTextFormatter.formatIban` 5 — empty; lowercase → upper; strips existing spaces before regrouping; long input groups every four chars; exactly four chars: no trailing space
`IbanInputFormatter.formatEditUpdate` 4 — groups output in fours and uppercases; drops invalid characters silently; caret stays collapsed at the end; empty input remains empty

What's pinned

  • `IbanTextFormatter` is the read-side display helper — it does not validate characters, it just regroups and uppercases.
  • `IbanInputFormatter` is the write-side `TextInputFormatter`; the regex `[A-Z0-9]` is applied after uppercasing, so lowercase letters survive but punctuation does not. The "drops invalid characters silently" case pins this contract.
  • The caret behaviour (`selection: TextSelection.collapsed(offset: text.length)`) is essential UX — explicit case covers it so a future refactor can't silently strand the caret mid-string.

Test plan

  • `flutter test test/widgets/iban_formatters_test.dart` — 9 pass
  • `flutter analyze` clean on the new file
  • CI green

Stage 42 of the coverage push. Pure-function tests for the two
IBAN formatters that drive the bank-account input field.

- IbanTextFormatter.formatIban (5): empty input; lowercase →
  upper; existing spaces stripped before regrouping; long input
  groups every four chars; exactly four chars: no trailing space
- IbanInputFormatter.formatEditUpdate (4): groups output in 4s
  and uppercases; drops invalid characters silently; caret stays
  collapsed at the end; empty input remains empty
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 19:01
@TaprootFreak TaprootFreak merged commit f6dce56 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/iban-formatters branch May 15, 2026 19:01
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.

1 participant