diff --git a/src/app/components/item-form/item-form.component.ts b/src/app/components/item-form/item-form.component.ts
index 96338dc..f84eb7b 100644
--- a/src/app/components/item-form/item-form.component.ts
+++ b/src/app/components/item-form/item-form.component.ts
@@ -111,6 +111,7 @@ export interface ItemFormAutofillPatch {
Poster
{
});
});
+ it('seeds poster search with the item title when opened', async () => {
+ vi.useFakeTimers();
+ const tmdbSuggestionService = TestBed.inject(TmdbSuggestionService);
+ const search = vi.mocked(tmdbSuggestionService.search);
+ try {
+ const fixture = TestBed.createComponent(PosterPickerComponent);
+ fixture.componentRef.setInput('searchSeed', ' Test Movie ');
+ fixture.detectChanges();
+
+ fixture.componentInstance.openPosterSearch();
+
+ expect(fixture.componentInstance.showPosterSearch()).toBe(true);
+ expect(fixture.componentInstance.posterSearchQuery()).toBe('Test Movie');
+
+ await vi.advanceTimersByTimeAsync(300);
+ expect(search).toHaveBeenCalledWith('Test Movie');
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
it('searches TMDB for posters after debounce', async () => {
vi.useFakeTimers();
const tmdbSuggestionService = TestBed.inject(TmdbSuggestionService);
diff --git a/src/app/components/poster-picker/poster-picker.component.ts b/src/app/components/poster-picker/poster-picker.component.ts
index 50b0688..6d89854 100644
--- a/src/app/components/poster-picker/poster-picker.component.ts
+++ b/src/app/components/poster-picker/poster-picker.component.ts
@@ -104,7 +104,7 @@ import { createTmdbSearchStream } from '../../utils/tmdb-search.utils';
@if (!showPosterSearch()) {