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 7 additions and 6 deletions
Showing only changes of commit 06bf567b90 - Show all commits

View File

@@ -115,10 +115,10 @@
{:else if suggestion.hasConflict}
<span
data-testid="badge-{suggestion.recipe.id}"
data-type="warning"
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);"
data-type="bad"
style="display: inline-block; margin-top: 3px; font-size: 9px; font-weight: 500; padding: 1px 5px; border-radius: 3px; background: var(--red-tint, #fdecea); color: var(--color-error, #d9534f);"
>
⚠ Variationskonflikt
{(suggestion.scoreDelta ?? 0).toFixed(1)} Punkte
</span>
{/if}
</div>

View File

@@ -47,11 +47,12 @@ describe('RecipePicker', () => {
expect(badge.getAttribute('data-type')).toBe('good');
});
it('shows yellow badge when hasConflict is true', () => {
it('shows red delta badge when hasConflict is true', () => {
render(RecipePicker, { props: baseProps });
// Hähnchen-Curry: hasConflict = true → yellow badge
// Hähnchen-Curry: hasConflict = true, scoreDelta = -1.5 → red badge with delta
const badge = screen.getByTestId('badge-s2');
expect(badge.getAttribute('data-type')).toBe('warning');
expect(badge.getAttribute('data-type')).toBe('bad');
expect(badge.textContent).toContain('-1.5');
});
it('shows Alle Rezepte section', () => {