Repository navigation
Description
Sub-issue of #97970.
Migration plan: jmgraa comment.
NumberWithSymbolForm has no dedicated test file. Two of its three render paths have zero coverage. Before any of the composition work starts, this issue writes characterization tests against the component exactly as it exists today, so every later batch has a regression net to run.
This is the only issue in the decomposition that does not change production code.
Scope
- Step: prerequisite, added ahead of step 1 of the migration plan
- Scope: 1 new test file
Coverage today
Only two tests mount the component at all, both indirectly and both through the portrait path:
tests/ui/IOURequestStepHoursTest.tsx— rendersIOURequestStepHours, asserts thehrssymbol renders and that the value prefills. The component name appears only in comments, not as an import.tests/ui/IOURequestStepAmountDraftTest.tsx— rendersIOURequestStepAmount→MoneyRequestAmountForm→MoneyRequestAmountInput→NumberWithSymbolForm, assertsgetByTestId('moneyRequestAmountInput').
Nothing covers the displayAsTextInput path or the landscape path.
Files
tests/ui/NumberWithSymbolFormTest.tsx— new
What to cover
Three render paths, all reached by early return in src/components/NumberWithSymbolForm.tsx:
displayAsTextInput(line 542) — plainTextInputwithrightHandSideComponent. No number pad, noScrollView, no landscape handling.isInLandscapeMode(line 636) — rowScrollView, sharedtextInputComponent, button row,FormHelpMessage,BigNumberPad, footer.- Portrait default (line 701) —
ScrollView, optionalshouldWrapInputInContainerwrapper, up to two currency buttons, pad and footer block.
The imperative contract, which every migration batch must preserve verbatim:
NumberWithSymbolFormRef={clearSelection, updateNumber, getNumber}, wired throughuseImperativeHandle(line 431). 8 files hold one of these refs.- The separate
ref?: ForwardedRef<BaseTextInputRef>prop, which is not ReactforwardRefand is fanned out manually to bothrefand the internaltextInputin each path.
Behaviour that differs per path and is easy to lose in a refactor:
- Negation. The
displayAsTextInputpath calls the internalhandleFlipPress(line 470). The other two call the caller suppliedtoggleNegative. Cover both. - Value setting.
setNewNumber(line 283) serves the pad and the symbol input.setFormattedNumber(line 323) servesdisplayAsTextInputonly and additionally appliesaddLeadingZero. Cover the leading zero difference explicitly. - Selection.
handleSelectionChange(line 444) withshouldIgnoreSelectionWhenUpdatedManuallyandshouldUpdateSelectionboth set and unset. - Validation and rejection through
validateAmountwithdecimals,maxLength,allowNegativeInputandallowFlippingAmount. - Backspace on an empty input while negative (line 414) clears the sign.
Out of scope
- Any change to
src/components/NumberWithSymbolForm.tsx. These tests describe current behaviour, including behaviour we consider wrong. - Testing the dead props. They are documented in the deprecation guide instead.
Acceptance criteria
-
tests/ui/NumberWithSymbolFormTest.tsxcovers all three render paths - All three
NumberWithSymbolFormRefmethods are asserted - Both negation mechanisms are asserted
- The
addLeadingZerodifference between the two value setters is asserted - Tests pass on
mainwith no production code change - Verify that no errors appear in the JS console
Dependencies
- Blocks: #98169
Activity
melvin-bot commentedon Aug 21, 2026
@bernhardoj
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.57-3 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-08-28. 🎊
The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]