Repository navigation
fix: preserve input when swap fails - #261
Conversation
anurag629
left a comment
There was a problem hiding this comment.
Thanks @piyusshhjangid, the fix itself is the right one: the check is in swap and the button is disabled. Two things before I can merge:
- The branch starts from an old
develop(b3d036d, from #188), so it conflicts now. Since then #227 set up component tests, and #236 and #242 changed the URL encoder's switch, so please rebase on the currentdevelop. developalready runs component tests with happy-dom (app/**/*.test.tsx, from #227), so thevitest.config.tschange and the two new.test.tsfiles aren't needed. Please put the tests in the existingTextTab.test.tsxandUrlEncoderClient.test.tsxand render the component, like the paste tests there: with an error showing, Swap is disabled and the Base64 shortcut doesn't clear the input, and a valid result still swaps. ThecanSwaptests only check the helper, so they'd still pass if the button or the shortcut lost the check.
8d87c47 to
1e9ebe1
Compare
|
Thanks for the feedback. I rebased onto the latest develop, removed the redundant Vitest config change, and moved the regression tests into the existing component test suites. They now render each tool and verify that errors preserve the input through the URL swap command and Base64 shortcut, while valid results still swap. I’ve pushed the update to this PR. |
anurag629
left a comment
There was a problem hiding this comment.
Thanks @piyusshhjangid, that's it. Lint, the 598 tests, the build and the page check pass on top of develop, and both new component tests fail with develop's components, where the Base64 shortcut and the URL encoder's command still clear the input.
Closes #252
Summary
Prevent Swap from clearing user input after a failed URL or Base64 text conversion.
Changes
How I tested this
npm run lintnpm run testnpm run buildAI assistance
OpenAI Codex helped implement the fix, add tests, and run verification.