diff options
Diffstat (limited to 'frontend/src/components/FeedItem.test.tsx')
| -rw-r--r-- | frontend/src/components/FeedItem.test.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/frontend/src/components/FeedItem.test.tsx b/frontend/src/components/FeedItem.test.tsx index 5ca5582..f0497c6 100644 --- a/frontend/src/components/FeedItem.test.tsx +++ b/frontend/src/components/FeedItem.test.tsx @@ -51,4 +51,21 @@ describe('FeedItem Component', () => { }) })); }); + + it('updates styling when read state changes', () => { + const { rerender } = render(<FeedItem item={{ ...mockItem, read: false }} />); + const link = screen.getByText('Test Item'); + // Initial state: unread (bold) + // Note: checking computed style might be flaky in jsdom, but we can check the class on the parent + const listItem = link.closest('li'); + expect(listItem).toHaveClass('unread'); + expect(listItem).not.toHaveClass('read'); + + // Update prop to read + rerender(<FeedItem item={{ ...mockItem, read: true }} />); + + // Should now be read + expect(listItem).toHaveClass('read'); + expect(listItem).not.toHaveClass('unread'); + }); }); |
