Whole-form htmx + Alpine morph for transaction edit
Re-render the entire #wizard-form on each field edit and swap with hx-swap="morph" so the focused input keeps focus/caret/value while typing. - Field-level routes return the full form and target #wizard-form - Key state-owning wrappers (account rows, simple-mode wrapper, vendor typeahead) so server-driven value changes re-init across the morph - Guard tippy/$refs access in typeahead against stale post-morph state - Round-trip simple/advanced mode via step-params[mode] - Add e2e/transaction-edit-morph.spec.ts covering focus/caret preservation, vendor->account population, and repeated vendor changes - Seed a second vendor/account for test isolation Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,9 @@
|
||||
{:db/id "vendor-id"
|
||||
:vendor/name "Test Vendor"
|
||||
:vendor/default-account "account-id"}
|
||||
{:db/id "vendor-id-2"
|
||||
:vendor/name "Second Vendor"
|
||||
:vendor/default-account "account-id-2"}
|
||||
(test-transaction :db/id "transaction-id"
|
||||
:transaction/client "client-id"
|
||||
:transaction/bank-account "bank-account-id"
|
||||
@@ -135,19 +138,19 @@
|
||||
:payment/status :payment-status/pending
|
||||
:payment/date #inst "2023-06-15")
|
||||
;; Transaction and unpaid invoice for link testing
|
||||
(test-transaction :db/id "transaction-id-unpaid"
|
||||
:transaction/client "client-id"
|
||||
:transaction/bank-account "bank-account-id"
|
||||
:transaction/amount -150.0
|
||||
:transaction/description-original "Transaction for unpaid invoice link"
|
||||
:transaction/approval-status :transaction-approval-status/unapproved)
|
||||
(test-transaction :db/id "transaction-id-feedback"
|
||||
:transaction/client "client-id"
|
||||
:transaction/bank-account "bank-account-id"
|
||||
:transaction/amount 400.0
|
||||
:transaction/description-original "Transaction for feedback review"
|
||||
:transaction/approval-status :transaction-approval-status/requires-feedback)
|
||||
(test-invoice :db/id "invoice-unpaid-id"
|
||||
(test-transaction :db/id "transaction-id-unpaid"
|
||||
:transaction/client "client-id"
|
||||
:transaction/bank-account "bank-account-id"
|
||||
:transaction/amount -150.0
|
||||
:transaction/description-original "Transaction for unpaid invoice link"
|
||||
:transaction/approval-status :transaction-approval-status/unapproved)
|
||||
(test-transaction :db/id "transaction-id-feedback"
|
||||
:transaction/client "client-id"
|
||||
:transaction/bank-account "bank-account-id"
|
||||
:transaction/amount 400.0
|
||||
:transaction/description-original "Transaction for feedback review"
|
||||
:transaction/approval-status :transaction-approval-status/requires-feedback)
|
||||
(test-invoice :db/id "invoice-unpaid-id"
|
||||
:invoice/client "client-id"
|
||||
:invoice/vendor "vendor-id"
|
||||
:invoice/total 150.0
|
||||
@@ -166,7 +169,8 @@
|
||||
:second-account (get tempids "account-id-2")
|
||||
:fixed-location-account (get tempids "account-id-fixed-loc")
|
||||
:ap-account (get tempids "ap-account-id")
|
||||
:vendor (get tempids "vendor-id")})
|
||||
:vendor (get tempids "vendor-id")
|
||||
:vendor2 (get tempids "vendor-id-2")})
|
||||
(reset! test-client-ids
|
||||
{:test (get tempids "client-id")
|
||||
:test2 (get tempids "client-id-2")})
|
||||
|
||||
Reference in New Issue
Block a user