diff --git a/frontend/src/lib/components/DocumentBottomPanel.svelte b/frontend/src/lib/components/DocumentBottomPanel.svelte index 7213d7c4..ee461e6c 100644 --- a/frontend/src/lib/components/DocumentBottomPanel.svelte +++ b/frontend/src/lib/components/DocumentBottomPanel.svelte @@ -107,7 +107,7 @@ function handleCountChange(count: number) {
@@ -126,15 +126,6 @@ function handleCountChange(count: number) {
- {#if !open && discussionCount === 0} - - {/if} -
{#each tabs as tab (tab.id)} @@ -146,7 +137,7 @@ function handleCountChange(count: number) { aria-pressed={activeTab === tab.id && open} > {tab.label()} - {#if tab.id === 'discussion' && discussionCount > 0} + {#if tab.id === 'discussion'} { - it('shows a badge with comment count on the Discussion tab when comments exist', async () => { + it('always shows a badge on the Discussion tab', async () => { + render(DocumentBottomPanel, { ...baseProps, comments: [], open: true }); + await expect.element(page.getByTestId('discussion-count-badge')).toBeInTheDocument(); + await expect.element(page.getByTestId('discussion-count-badge')).toHaveTextContent('0'); + }); + + it('shows the correct count when comments exist', async () => { render(DocumentBottomPanel, { ...baseProps, comments: [makeComment('c-1'), makeComment('c-2')], open: true }); - await expect.element(page.getByTestId('discussion-count-badge')).toBeInTheDocument(); await expect.element(page.getByTestId('discussion-count-badge')).toHaveTextContent('2'); }); - - it('does not show badge when there are no comments', async () => { - render(DocumentBottomPanel, { ...baseProps, comments: [], open: true }); - await expect.element(page.getByTestId('discussion-count-badge')).not.toBeInTheDocument(); - }); -}); - -describe('DocumentBottomPanel – start discussion nudge', () => { - it('shows nudge above drag handle when panel is closed and no comments', async () => { - render(DocumentBottomPanel, { ...baseProps, comments: [], open: false }); - await expect.element(page.getByTestId('discussion-nudge')).toBeInTheDocument(); - }); - - it('does not show nudge when panel is closed but comments exist', async () => { - render(DocumentBottomPanel, { - ...baseProps, - comments: [makeComment('c-1')], - open: false - }); - await expect.element(page.getByTestId('discussion-nudge')).not.toBeInTheDocument(); - }); - - it('does not show nudge when panel is open', async () => { - render(DocumentBottomPanel, { ...baseProps, comments: [], open: true }); - await expect.element(page.getByTestId('discussion-nudge')).not.toBeInTheDocument(); - }); - - it('opens the discussion tab when the nudge is clicked', async () => { - render(DocumentBottomPanel, { ...baseProps, comments: [], open: false }); - await userEvent.click(page.getByTestId('discussion-nudge')); - await expect.element(page.getByTestId('bottom-panel-content')).toBeInTheDocument(); - }); });