From 9634f5fb453cd44bf047a5807f95c0f8542b2943 Mon Sep 17 00:00:00 2001 From: eti Date: Tue, 15 Sep 2026 14:01:12 +0200 Subject: [PATCH] web/components/repo: drop the zero count from a diff stat pill Signed-off-by: eti --- .../repo/DiffStatPill.stories.svelte | 22 +++++++++++++++++-- .../lib/components/repo/DiffStatPill.svelte | 16 +++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/web/src/lib/components/repo/DiffStatPill.stories.svelte b/web/src/lib/components/repo/DiffStatPill.stories.svelte index 47e6db2c7..81376aab4 100644 --- a/web/src/lib/components/repo/DiffStatPill.stories.svelte +++ b/web/src/lib/components/repo/DiffStatPill.stories.svelte @@ -10,6 +10,16 @@ await expect(canvas.getByText("-4")).toBeVisible(); }; + const showsInsertionsOnly = async ({ canvas, canvasElement }: PlayContext) => { + await expect(canvas.getByText("+12")).toBeVisible(); + await expect(canvasElement.textContent).not.toContain("-0"); + }; + + const showsDeletionsOnly = async ({ canvas, canvasElement }: PlayContext) => { + await expect(canvas.getByText("-4")).toBeVisible(); + await expect(canvasElement.textContent).not.toContain("+0"); + }; + const rendersNothing = async ({ canvasElement }: PlayContext) => { await expect(canvasElement.textContent?.trim()).toBe(""); }; @@ -26,9 +36,17 @@ - + - + 0 || stat.deletions > 0}
- - +{stat.insertions} - - - -{stat.deletions} - + {#if stat.insertions > 0} + + +{stat.insertions} + + {/if} + {#if stat.deletions > 0} + + -{stat.deletions} + + {/if}
{/if} -- 2.51.2