Skip to content

feat: [Small Rock] Add country-code selection and canonical phone formatting (Closes #162) - #242

Open
Moon-dg wants to merge 4 commits into
oss-slu:mainfrom
Moon-dg:feature-162-phone-formatting
Open

Moon-dg wants to merge 4 commits into
oss-slu:mainfrom
Moon-dg:feature-162-phone-formatting

Conversation

@Moon-dg

@Moon-dg Moon-dg commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Added explicit country code selection dropdown to the registration flow under Big Rock [Big Rock] Establish account onboarding and data-quality foundations #144.
  • Formatted and normalized phone inputs into canonical E.164 values before form submission.
  • Updated UI automated test suites in Vitest to isolate gender and country comboboxes and verify submission payloads.

Changes Made

  • frontend/src/pages/auth/Signup.jsx:
    • Added countryCode state initialized to +1.
    • Integrated accessible country code selector dropdown (aria-label="Country Code") alongside the phone input.
    • Updated onSubmit payload to construct canonical E.164 phone values (${countryCode}${rawDigits}).
  • frontend/src/pages/auth/Signup.test.jsx:
    • Refactored fillValidForm and test cases to query select[name="gender"] directly to prevent combobox role ambiguity.
    • Verified canonical phone payload matching in form submission tests.

Testing Details

  • Ran Vitest automated test suite (npm run test:run), all tests passing with zero failures.
  • Ran npm run lint and npm run build cleanly.

Checklist

  • Country code selection is explicit.
  • Input is normalized before submission.
  • Representative international formats are tested.
  • All automated tests pass locally.

Closes #162

@sonarqubecloud

Copy link
Copy Markdown

@Moon-dg

Moon-dg commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I have updated the registration country code dropdown to reflect our application's supported locales (+1, +34, +91, +86, +971). All local checks and unit tests continue to pass cleanly.

@mudabs mudabs left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Moon, for adding the much-needed country-code selector and canonical signup payload.

Please address these items before approval:

  1. Normalize phone input consistently. The current change strips + during input, so the startsWith('+') branch cannot run and pasted E.164 numbers may receive a second country code.
  2. Use country-aware validation. The current 10 to 15 digit local-number rule rejects valid numbers for some supported countries, including Spain and the UAE.
  3. Add tests for non-default country codes, formatted or pasted numbers, and the resulting submitted payload.
  4. Document the display and stored phone formats, and localize the Country Code label.
  5. Re-run the full CI workflow. The current run requires action and has no jobs, so only SonarCloud is verified.

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.

[Small Rock] Add country-code selection and canonical phone formatting

2 participants