fix(examples): trigger inline validation on input events
req: runtime/005 req: examples/001
This commit is contained in:
@@ -661,6 +661,16 @@ mod tests {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inline_validation_form_uses_input_event_for_revalidation() {
|
||||
let state = Arc::new(GalleryState::seeded());
|
||||
let html = gallery_view(&state).render().expect("render gallery");
|
||||
assert!(
|
||||
html.contains("data-hemx-on=\"input\""),
|
||||
"inline validation form must listen on input events"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn readme_maps_every_htmx_example_slug() {
|
||||
let readme = include_str!("../README.md");
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<section id="inline-validation" data-htmx-example="inline-validation" aria-labelledby="validation-heading">
|
||||
<h2 id="validation-heading">inline-validation</h2>
|
||||
<form data-hemx-handle="validate_email" data-hemx-form="validate_email">
|
||||
<form data-hemx-handle="validate_email" data-hemx-form="validate_email" data-hemx-on="input">
|
||||
<label>Email <input name="email" +value="self.email" required="required"></label>
|
||||
<button type="submit">Validate</button>
|
||||
<p data-hemx-error-for="email"></p>
|
||||
|
||||
Reference in New Issue
Block a user