From c652ac6a2cd23ef29f48465be09c2b674783e8e9 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sun, 15 Feb 2026 17:44:55 -0800 Subject: Vanilla JS (v3): Implement 3-pane layout, item fetching, reading, and testing --- frontend-vanilla/src/components/FeedItem.test.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 frontend-vanilla/src/components/FeedItem.test.ts (limited to 'frontend-vanilla/src/components/FeedItem.test.ts') diff --git a/frontend-vanilla/src/components/FeedItem.test.ts b/frontend-vanilla/src/components/FeedItem.test.ts new file mode 100644 index 0000000..708a871 --- /dev/null +++ b/frontend-vanilla/src/components/FeedItem.test.ts @@ -0,0 +1,23 @@ +import { describe, it, expect } from 'vitest'; +import { createFeedItem } from './FeedItem'; + +describe('FeedItem Component', () => { + const mockFeed = { _id: 1, title: 'My Feed', url: 'http://test', web_url: 'http://test', category: 'tag' }; + + it('should render a feed item correctly', () => { + const html = createFeedItem(mockFeed, false); + expect(html).toContain('My Feed'); + expect(html).toContain('data-id="1"'); + expect(html).not.toContain('active'); + }); + + it('should apply active class when isActive is true', () => { + const html = createFeedItem(mockFeed, true); + expect(html).toContain('active'); + }); + + it('should fallback to URL if title is missing', () => { + const html = createFeedItem({ ...mockFeed, title: '' }, false); + expect(html).toContain('http://test'); + }); +}); -- cgit v1.2.3