Add regression coverage for external value prop updates in controlled input#47
Add regression coverage for external value prop updates in controlled input#47Copilot wants to merge 3 commits into
value prop updates in controlled input#47Conversation
|
There is no change log for this pull request yet. |
value prop updates in controlled input
|
@copilot This seems like it's doing the exact same thing as the test immediately below it, so either ... we don't have a bug here... or we're misunderstanding the bug? it does say "setting the form value" specifically "not the user typing in the field", so I think that's different from using .fill ... isn't it? |
There was a problem hiding this comment.
Pull request overview
Adds a targeted Playwright regression test to protect the controlled-component contract for CurrencyInput, ensuring the displayed (masked) input value updates immediately when the parent updates the value prop outside of user typing / onChangeEvent.
Changes:
- Added a new controlled-value Playwright test covering sequential parent-driven
valueupdates (2 → 4) and asserting the rendered masked value updates accordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You're right — the first test was redundant. Removed it. To clarify the mechanism: The remaining test captures the specific regression scenario: the user first types into the currency input (setting its internal value to |
The issue reports that
CurrencyInputcan appear stale when the parent updatesvalueoutsideonChangeEvent. This PR adds focused coverage for that controlled-update path to ensure the renderedmaskedValuetracks prop changes.Problem scope
valueprop externally — the display must reflect the parent's value rather than appearing stale.What changed
tests/controlled-value.spec.ts:5000directly into the currency input → asserts$50.00 USDvalueto22.22via the form's Apply button (calls ReactsetValue())$22.22 USD, not the previously user-typed valueWhy this matters
valueprop update must override any prior user-typed value immediately, with no stale display.