fix(planner): format variety score to one decimal place
Avoids floating-point display like 6.199999999999999 by using score.toFixed(1) in VarietyScoreCard. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
<div class="rounded-[var(--radius-lg)] border border-[var(--yellow-light)] bg-[var(--yellow-tint)] p-4">
|
<div class="rounded-[var(--radius-lg)] border border-[var(--yellow-light)] bg-[var(--yellow-tint)] p-4">
|
||||||
<div class="flex items-baseline gap-1">
|
<div class="flex items-baseline gap-1">
|
||||||
<span class="font-[var(--font-display)] text-[28px] font-[300] text-[var(--color-text)] md:text-[40px]">
|
<span class="font-[var(--font-display)] text-[28px] font-[300] text-[var(--color-text)] md:text-[40px]">
|
||||||
{score}
|
{score.toFixed(1)}
|
||||||
</span>
|
</span>
|
||||||
<span class="font-[var(--font-sans)] text-[13px] text-[var(--color-text-muted)]">/10</span>
|
<span class="font-[var(--font-sans)] text-[13px] text-[var(--color-text-muted)]">/10</span>
|
||||||
<span class="ml-1 font-[var(--font-sans)] text-[12px] text-[var(--color-text-muted)]">Abwechslungs-Score</span>
|
<span class="ml-1 font-[var(--font-sans)] text-[12px] text-[var(--color-text-muted)]">Abwechslungs-Score</span>
|
||||||
|
|||||||
@@ -51,7 +51,13 @@ describe('VarietyScoreCard', () => {
|
|||||||
|
|
||||||
it('renders with score 0', () => {
|
it('renders with score 0', () => {
|
||||||
render(VarietyScoreCard, { props: { ...baseProps, score: 0 } });
|
render(VarietyScoreCard, { props: { ...baseProps, score: 0 } });
|
||||||
expect(screen.getByText('0')).toBeTruthy();
|
expect(screen.getByText('0.0')).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rounds floating-point scores to one decimal place', () => {
|
||||||
|
render(VarietyScoreCard, { props: { ...baseProps, score: 6.199999999999999 } });
|
||||||
|
expect(screen.getByText('6.2')).toBeTruthy();
|
||||||
|
expect(screen.queryByText('6.199999999999999')).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders multiple ingredient overlap warnings', () => {
|
it('renders multiple ingredient overlap warnings', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user