diff --git a/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts b/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts index 6a07cc559..3a4d0a669 100644 --- a/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts +++ b/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts @@ -760,6 +760,15 @@ describe('withStalkerContent full ITV channel list cache', () => { void store.isPaginatedContentLoading(); } + it('does not request paged channels without a selected category', async () => { + setup(null); + enterItvCategory(''); + await flushResources(); + expect(store.itvChannels()).toEqual([]); + expect(store.hasMoreChannels()).toBe(false); + expect(dataService.sendIpcEvent).not.toHaveBeenCalled(); + }); + it('serves the whole category from the cache without portal requests', async () => { setup(CACHED_CHANNELS); enterItvCategory('5'); diff --git a/libs/portal/stalker/feature/src/lib/stalker-live-stream-layout/stalker-live-stream-layout.panel-search.spec.ts b/libs/portal/stalker/feature/src/lib/stalker-live-stream-layout/stalker-live-stream-layout.panel-search.spec.ts index 9a7d151b6..2faea785c 100644 --- a/libs/portal/stalker/feature/src/lib/stalker-live-stream-layout/stalker-live-stream-layout.panel-search.spec.ts +++ b/libs/portal/stalker/feature/src/lib/stalker-live-stream-layout/stalker-live-stream-layout.panel-search.spec.ts @@ -100,6 +100,7 @@ describe('StalkerLiveStreamLayoutComponent fullscreen panel search', () => { store.selectedContentType.set('itv'); store.radioChannels.set([]); store.itvFullChannelList.set([]); + store.itvFullListLoading.set(false); store.setPage.mockClear(); await TestBed.configureTestingModule({ imports: [ @@ -205,6 +206,32 @@ describe('StalkerLiveStreamLayoutComponent fullscreen panel search', () => { expect(component.channelsForList(panelTerm)).toHaveLength(100); }); + it('searches paged All Items while the full cache is still loading', () => { + store.selectedCategoryId.set('*'); + store.itvFullListLoading.set(true); + searchPhrase.set('one'); + fixture.detectChanges(); + expect(component.showItvAllItems()).toBe(false); + expect(component.filteredChannels()).toEqual([channels[0]]); + expect(component.channelsForList(signal('two'))).toEqual([channels[1]]); + }); + + it('does not relabel retained category rows as the initial All Items grid', () => { + // No selected category has no provider-page request. The unselected + // grid waits for the public cache, even if a prior category's rows + // are still present before the store's reset effect settles. + store.selectedCategoryId.set(null); + store.itvFullListLoading.set(true); + searchPhrase.set('one'); + fixture.detectChanges(); + expect(component.showItvAllItems()).toBe(true); + expect(component.filteredChannels()).toEqual([]); + expect(component.channelsForList(signal('two'))).toEqual([]); + store.itvFullChannelList.set(channels); + expect(component.filteredChannels()).toEqual([channels[0]]); + expect(component.channelsForList(signal('two'))).toEqual([channels[1]]); + }); + it('does not search the ITV cache after switching to radio', () => { itvFullListActive.set(true); store.itvFullChannelList.set(channels);