feat(recipes): display form error from \$page.form in RecipeForm
- Import page store and render role="alert" error banner - Add mock for \$app/stores and \$app/forms in RecipeForm tests - Add tests: error banner shown when form.error set, hidden when null Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
|
||||
type Category = { id: string; name: string; tagType?: string };
|
||||
|
||||
type EditRecipe = {
|
||||
@@ -45,6 +47,11 @@
|
||||
</script>
|
||||
|
||||
<form method="POST" {action}>
|
||||
<!-- Error banner -->
|
||||
{#if $page.form?.error}
|
||||
<div role="alert">{$page.form.error}</div>
|
||||
{/if}
|
||||
|
||||
<!-- Basic info -->
|
||||
<label for="name">Name</label>
|
||||
<input id="name" name="name" type="text" bind:value={name} required />
|
||||
|
||||
Reference in New Issue
Block a user