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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user