SynergyJSv0.4.x

Forms, Event Bindings & E2E Verification

SynergyJS maps standard DOM event attributes (onclick, onsubmit, oninput) directly to methods on your component view-model, while keeping form state synchronized with named inputs.

Declarative Form Example

<template id="otp-signup">
  <form onsubmit="requestCode">
    <label>Work Email</label>
    <input type="email" name="email" value="{{ email }}" required />
    <button type="submit" disabled="{{ sending }}">Send OTP Code</button>
  </form>
</template>

<script type="module">
  import { define } from 'synergy'

  define('otp-signup', () => ({
    email: '',
    sending: false,
    async requestCode(event) {
      event.preventDefault()
      this.sending = true
      await fetch('/api/auth/otp', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ email: this.email })
      })
      this.sending = false
    }
  }))
</script>

Testing Passwordless & OTP Flows in CI

When shipping signup or passwordless login Web Components, unit tests alone cannot verify real SMTP delivery or token expiration. In CI pipelines, teams commonly generate a fresh disposable address per test run and poll an API inbox for the 6-digit verification code.

Using MailBots automated email OTP testing alongside Playwright or Puppeteer lets you test the real SynergyJS form submission end-to-end without maintaining brittle shared test mailboxes.