A postcode control may accept a finished value but corrupt it while someone edits the middle. For Portuguese-format fixtures, test the hyphen as part of the interaction rather than removing it and adding it back only on the confirmation screen.

Set up a focused test

Use “1000-001” as a format fixture, without claiming it verifies the accompanying street. Paste the whole value, replace one digit, delete the hyphen and undo the edit. Record the expected behavior for an incomplete value. A form should not trap the cursor or silently rewrite a partially entered postcode into a different value.

Run the checks

  1. Paste a complete postcode into an empty input.
  2. Replace a selection that crosses the hyphen.
  3. Submit an incomplete value and inspect the field error.
  4. Reload a saved record and compare the stored string.

Interpret the result

Keep display formatting and business validation separate. If the application accepts both compact and hyphenated input, document the stored representation and test both routes. Refer to the linked country tool’s postal reference for the format; synthetic records remain unsuitable as evidence of a real residence.

Open the related address tool to prepare synthetic examples for your test.