From 180437d228553542373c45f31f152d6c3e95cccd Mon Sep 17 00:00:00 2001
From: CodeWithMaBot <310216433+CodeWithMaBot@users.noreply.github.com>
Date: Sun, 23 Aug 2026 12:48:02 +0200
Subject: [PATCH 1/3] feat(home): add dedicated paused section
---
.../components/home/home.component.spec.ts | 79 +++++++++++++++++++
src/app/components/home/home.component.ts | 56 +++++++++++++
.../item-form/item-form.component.spec.ts | 28 +++++++
.../item-form/item-form.component.ts | 18 +----
src/app/domain/item-form.spec.ts | 36 +++++++--
src/app/domain/item-form.ts | 7 +-
src/app/services/watch-list.service.spec.ts | 4 +-
src/app/services/watch-list.service.ts | 3 +-
8 files changed, 201 insertions(+), 30 deletions(-)
create mode 100644 src/app/components/home/home.component.spec.ts
diff --git a/src/app/components/home/home.component.spec.ts b/src/app/components/home/home.component.spec.ts
new file mode 100644
index 0000000..9695e0b
--- /dev/null
+++ b/src/app/components/home/home.component.spec.ts
@@ -0,0 +1,79 @@
+import { signal } from '@angular/core';
+import { TestBed } from '@angular/core/testing';
+import { provideRouter } from '@angular/router';
+import { vi } from 'vitest';
+import { Item } from '../../models/item.model';
+import { RoundRobinService } from '../../services/round-robin.service';
+import { WatchListService } from '../../services/watch-list.service';
+import { HomeComponent } from './home.component';
+
+describe('HomeComponent', () => {
+ const items: Item[] = [
+ {
+ id: 'paused-movie',
+ title: 'Paused Movie',
+ type: 'movie',
+ groupId: 'ungrouped',
+ status: 'paused',
+ watchHistory: [],
+ createdAt: '2026-05-02T10:00:00.000Z',
+ },
+ {
+ id: 'backlog-item',
+ title: 'Backlog Series',
+ type: 'series',
+ groupId: 'ungrouped',
+ status: 'not-started',
+ watchHistory: [],
+ createdAt: '2026-05-01T10:00:00.000Z',
+ },
+ ];
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [
+ provideRouter([]),
+ {
+ provide: RoundRobinService,
+ useValue: { nextSeries: signal(null), nextMovie: signal(null) },
+ },
+ {
+ provide: WatchListService,
+ useValue: {
+ items: signal(items),
+ inProgressSeries: signal([]),
+ markStarted: vi.fn(),
+ markDropped: vi.fn(),
+ },
+ },
+ ],
+ });
+ });
+
+ it('shows paused movies separately from backlog', async () => {
+ const fixture = TestBed.createComponent(HomeComponent);
+ fixture.detectChanges();
+ await fixture.whenStable();
+ fixture.detectChanges();
+
+ const sections = Array.from(
+ fixture.nativeElement.querySelectorAll('h2'),
+ ) as HTMLHeadingElement[];
+ const pausedSection = sections.find((section) => section.textContent?.trim() === 'Paused');
+ const pausedContainer = pausedSection?.parentElement;
+
+ expect(pausedContainer?.textContent).toContain('Paused Movie');
+ expect(pausedContainer?.textContent).not.toContain('Backlog Series');
+ });
+
+ it('resumes and drops paused items', () => {
+ const fixture = TestBed.createComponent(HomeComponent);
+ const watchListService = TestBed.inject(WatchListService);
+
+ fixture.componentInstance.resumePausedItem('paused-movie');
+ fixture.componentInstance.dropPausedItem('paused-movie');
+
+ expect(watchListService.markStarted).toHaveBeenCalledWith('paused-movie');
+ expect(watchListService.markDropped).toHaveBeenCalledWith('paused-movie');
+ });
+});
diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts
index ba8cf5e..0471370 100644
--- a/src/app/components/home/home.component.ts
+++ b/src/app/components/home/home.component.ts
@@ -161,6 +161,47 @@ import { Item, ItemType } from '../../models/item.model';
}
+
+
Status:
- @for (status of itemStatuses(); track status) {
+ @for (status of itemStatuses; track status) {
}
+ } @else {
+