diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts index 6f85da6..13e5e51 100644 --- a/src/app/features/indicadores/indicadores-page.ts +++ b/src/app/features/indicadores/indicadores-page.ts @@ -38,6 +38,7 @@ const SECTIONS: readonly { id: DashboardSection; label: string }[] = [ ]; // Domains with enough periods for their history to say anything. const CON_HISTORICO: readonly Dominio[] = ['tea', 'cama']; +const MIN_BUSQUEDA = 5; const HISTORICO_SECTIONS: readonly { id: DashboardSection; label: string }[] = [SECTIONS[0], { id: 'historico', label: 'Histórico' }, SECTIONS[1], SECTIONS[2]]; @Component({ @@ -307,7 +308,8 @@ export class IndicadoresPage { readonly catalog = signal([]); // Ids of the indicators to render; null shows the whole catalog. readonly indicatorSelection = signal(null); - readonly searchVisible = computed(() => this.catalogOrder().length >= 2); + // With a few indicators every card is in view; the selector only pays off from MIN_BUSQUEDA on. + readonly searchVisible = computed(() => this.catalogOrder().length >= MIN_BUSQUEDA); // Stable presentation priority; pins still take precedence in the grid. readonly catalogOrder = computed(() => { const catalog = this.catalog(); diff --git a/src/app/features/indicadores/indicadores-search.spec.ts b/src/app/features/indicadores/indicadores-search.spec.ts index e66dfd1..e4babe4 100644 --- a/src/app/features/indicadores/indicadores-search.spec.ts +++ b/src/app/features/indicadores/indicadores-search.spec.ts @@ -45,9 +45,10 @@ describe('Selección de indicadores gráficos', () => { function result() { return (fixture.nativeElement.querySelector('#catalog-search-result') as HTMLElement).textContent!.trim(); } function choose(selection: string[]) { page.changeIndicatorSelection(selection); fixture.detectChanges(); } - it.each([0, 1, 2, 5])('muestra el selector desde dos indicadores: catálogo de %i', count => { + it.each([0, 1, 4, 5, 6])('muestra el selector desde cinco indicadores: catálogo de %i', count => { + // Fails if the selector shows for a handful of cards, or stops showing for a long catalog. load(Array.from({ length: count }, (_, i) => ({ ...items[0], id: 'id-' + i }))); - expect(!!select()).toBe(count >= 2); expect(cards()).toHaveLength(count); + expect(!!select()).toBe(count >= 5); expect(cards()).toHaveLength(count); http.expectNone(() => true); }); it('lista todo el catálogo, con todos seleccionados al inicio', () => {