Indicators: a typed page size is brought into 1 to the maximum, one maximum for both lists

An input's max only flags the field and still lets a larger number be typed. The follow-up table and the tracking
list now clamp the value when it changes and when the query is sent, and both read the single PAGE_SIZE_MAX instead
of a literal 200.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
(cherry picked from commit 1342b1712d)
This commit is contained in:
2026-11-22 02:48:49 -06:00
committed by Angel Capetillo Zavala
parent 999bc4ecf5
commit feaed5ff0e
7 changed files with 35 additions and 13 deletions
@@ -7,7 +7,7 @@ import { HttpTestingController, provideHttpClientTesting } from '@angular/common
import fixtureData from './fixtures/cama_seguimiento.json';
import finalResponse from './fixtures/cama_seguimiento-final.json';
import outsideResponse from './fixtures/cama_seguimiento-out-of-range.json';
import { PAGE_SIZE_MAX, SeguimientoInvalido, SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService, seguimientoTablaResponse, validQuery } from './seguimiento-tabla.service';
import { acotarTamano, PAGE_SIZE_MAX, SeguimientoInvalido, SeguimientoTablaQuery, SeguimientoTablaResponse, SeguimientoTablaService, seguimientoTablaResponse, validQuery } from './seguimiento-tabla.service';
const clonar = () => structuredClone(fixtureData) as unknown as Record<string, any>;
const consulta: SeguimientoTablaQuery = { meses: 3, page: 1, page_size: 50 };
@@ -132,3 +132,16 @@ describe('Seguimiento genérico: petición', () => {
});
});
});
describe('acotarTamano', () => {
it('brings a typed page size into 1 to the maximum, and falls back when it is not a number', () => {
expect(acotarTamano(500)).toBe(PAGE_SIZE_MAX);
expect(acotarTamano('999')).toBe(PAGE_SIZE_MAX);
expect(acotarTamano(0)).toBe(1);
expect(acotarTamano(-7)).toBe(1);
expect(acotarTamano(25.9)).toBe(25);
expect(acotarTamano('')).toBe(1);
expect(acotarTamano('x')).toBe(50);
expect(acotarTamano(undefined, 20)).toBe(20);
});
});