fix: bug: Get KRK page swap widget broken with Playwright fill() (#393)

Replace v-model with :value + @input on the number input in LocalSwapWidget.
Vue 3's vModelText directive coerces <input type="number"> values to numbers
via looseToNumber(), causing swapAmount to become a JS number (e.g. 0.05) after
Playwright fill(). viem's parseEther() requires a string and throws when passed
a number, triggering the "Enter a valid ETH amount" error.

The fix mirrors FInput's explicit @input handler which always reads
event.target.value as a string, keeping swapAmount typed as string throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-01 18:15:50 +00:00
parent 6c4ede16ab
commit 6876e84735

View file

@ -6,7 +6,7 @@
<template v-else>
<div class="swap-field">
<label for="local-swap-amount" class="swap-label">ETH to spend</label>
<input id="local-swap-amount" v-model="swapAmount" type="number" min="0" step="0.01" class="swap-input" :disabled="swapping" />
<input id="local-swap-amount" :value="swapAmount" @input="swapAmount = ($event.target as HTMLInputElement).value" type="number" min="0" step="0.01" class="swap-input" :disabled="swapping" />
</div>
<button class="swap-button" :disabled="swapping" @click="buyKrk">
{{ swapping ? 'Submitting…' : 'Buy KRK' }}