feat(planner): wire variety-aware suggestions into RecipePicker for empty slots #47

Merged
marcel merged 30 commits from feat/issue-46-wire-suggestions-recipe-picker into master 2026-04-09 16:33:12 +02:00
2 changed files with 12 additions and 2 deletions
Showing only changes of commit 081b8dcaf0 - Show all commits

View File

@@ -120,6 +120,14 @@
>
{(suggestion.scoreDelta ?? 0).toFixed(1)} Punkte
</span>
{:else}
<span
data-testid="badge-{suggestion.recipe.id}"
data-type="neutral"
style="display: inline-block; margin-top: 3px; font-size: 9px; font-weight: 500; padding: 1px 5px; border-radius: 3px; background: var(--yellow-tint); color: var(--yellow-text);"
>
= {(suggestion.scoreDelta ?? 0).toFixed(1)} Punkte
</span>
{/if}
</div>
<button

View File

@@ -99,12 +99,14 @@ describe('RecipePicker', () => {
expect(screen.getByText(/Keine Treffer/i)).toBeTruthy();
});
it('shows no badge when scoreDelta is zero (neutral, no improvement)', () => {
it('shows yellow neutral badge when scoreDelta is zero', () => {
const neutralSuggestions = [
{ recipe: { id: 'sn', name: 'Neutrales Rezept', effort: 'easy', cookTimeMin: 20 }, scoreDelta: 0.0, hasConflict: false }
];
render(RecipePicker, { props: { ...baseProps, suggestions: neutralSuggestions } });
expect(screen.queryByTestId('badge-sn')).toBeNull();
const badge = screen.getByTestId('badge-sn');
expect(badge.getAttribute('data-type')).toBe('neutral');
expect(badge.textContent).toContain('0.0');
});
it('shows loading skeleton instead of Empfohlen section when isLoading is true', () => {