Add a system test for joining an account

Reworked the magic link stimulus controller, because the system test
was causing double-submission of the form (because the event was
bubbling up). I think that change simplifies the form and will still
work well for iOS devices.
This commit is contained in:
Mike Dalessio
2025-12-05 16:16:58 -05:00
parent 345f457513
commit fa549a370b
3 changed files with 33 additions and 7 deletions
@@ -4,12 +4,18 @@ import { onNextEventLoopTick } from "helpers/timing_helpers"
export default class extends Controller {
static targets = [ "input" ]
submitOnEnter(event) {
event.preventDefault()
this.submit()
}
submitOnPaste() {
onNextEventLoopTick(() => this.submit())
}
submit() {
onNextEventLoopTick(() => {
if (!this.inputTarget.disabled) {
this.element.submit()
this.inputTarget.disabled = true
}
})
if (this.inputTarget.disabled) return
this.element.submit()
this.inputTarget.disabled = true
}
}