feat(indicadores): "Buscar indicadores" only from five indicators
How: searchVisible compares the indicators shown in Resumen with MIN_BUSQUEDA (5) instead of 2. Below it every card is in view and the selector and its "Mostrando n de m" line are not rendered. Implications: cáncer de mama (three charts in Resumen) loses the selector; CaCu (five) and TEA keep it. Pinning still works without it. If a domain grows past the threshold the selector comes back with no other change.
This commit is contained in:
@@ -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<Indicador[]>([]);
|
||||
// Ids of the indicators to render; null shows the whole catalog.
|
||||
readonly indicatorSelection = signal<string[] | null>(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();
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user