feat(indicadores): dashboard interactivo multidominio y seguimiento CaCu

This commit is contained in:
Angel Capetillo Zavala
2026-10-22 17:10:35 -06:00
parent 9cc67c0ef2
commit 1fe88dfb45
62 changed files with 4380 additions and 187 deletions
@@ -44,11 +44,11 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
function kpiMissing() { http.match(r => r.url.endsWith('/datos')).forEach(r => r.flush('missing', { status: 404, statusText: 'Not Found' })); fixture.detectChanges(); }
function control(index = 0) { return fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))[index].componentInstance as IndicadorPeriodFilters; }
it('KPI-DYNAMIC TEA muestra sus tres destacados sin consultar datos fuera del catálogo', () => {
it('no presenta destacados retirados del catálogo ni consulta sus datos', () => {
load();
expect(fixture.nativeElement.querySelector('#kpi-section-title').textContent).toBe('Indicadores destacados');
expect(fixture.nativeElement.querySelector('#kpi-section-title')).toBeNull();
expect(Array.from(fixture.nativeElement.querySelectorAll('.kpi-grid app-indicador-kpi-card h3')).map(h => (h as HTMLElement).textContent))
.toEqual(['Total de pacientes evaluados', 'Porcentaje de confirmación diagnóstica', 'Tiempo de aplicación de M-CHAT (psicología) a diagnóstico positivo']);
.toEqual([]);
http.expectNone(r => r.url.endsWith('/datos'));
});
it('KPI-DYNAMIC distingue carga, error y catálogo vacío confirmado', () => {
@@ -63,7 +63,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
page.retryCatalog(); fixture.detectChanges(); load([]);
expect(page.catalogLoading()).toBe(false); expect(page.catalogError()).toBe('');
expect(fixture.nativeElement.textContent).toContain('No hay indicadores disponibles');
expect(fixture.nativeElement.querySelectorAll('.kpi-section app-indicador-kpi-card')).toHaveLength(3);
expect(fixture.nativeElement.querySelectorAll('.kpi-section app-indicador-kpi-card')).toHaveLength(0);
http.expectNone(() => true);
});
it('D.1 separa secciones y conserva tarjetas, orden, identidades y figuras dentro del grid', () => {
@@ -72,8 +72,11 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
expect(getComputedStyle(grid).display).toBe('grid');
expect(grid.children).toHaveLength(2);
expect(Array.from(grid.children).every(host => host.tagName === 'APP-INDICADOR-CATALOG-CARD')).toBe(true);
const sections = fixture.nativeElement.querySelectorAll('.dashboard > section') as NodeListOf<HTMLElement>;
expect(Array.from(sections).map(section => section.getAttribute('aria-labelledby'))).toEqual(['global-filters-title', 'kpi-section-title', 'graphic-section-title']);
const sections = fixture.nativeElement.querySelectorAll('#panel-resumen > section') as NodeListOf<HTMLElement>;
expect(Array.from(sections).map(section => section.getAttribute('aria-labelledby'))).toEqual(['global-filters-title', 'graphic-section-title']);
const summary = fixture.nativeElement.querySelector('app-indicadores-numeric-summary') as HTMLElement;
expect(sections[1].compareDocumentPosition(summary) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(summary.textContent).toContain('Resumen de indicadores');
expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('2 indicadores publicados');
expect(getComputedStyle(fixture.nativeElement.querySelector('.catalog-count')).textAlign).toBe('right');
toggle(0); toggle(1); flushAll();
@@ -282,7 +285,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
const c = control(); c.changeTipo('mes'); c.year = '2025'; c.unit = '01'; c.add(); http.expectNone(() => true);
page.applyFilters(); fixture.detectChanges(); const r = http.expectOne(r => r.url.includes('/figuras/'));
expect(r.request.params.get('periodos')).toBe('2025-01'); r.flush({ data: [{ y: [0, null] }], layout: {} }); fixture.detectChanges();
expect(fixture.nativeElement.textContent).toContain('no entregan intervalos Wilson efectivos');
expect(fixture.nativeElement.textContent).toContain('Cuando la figura publica intervalos Wilson al 95 %');
expect(fixture.nativeElement.textContent).toContain('suprimidos no representan tasas observadas de 0 %');
});
it('catálogo error, reintento y vacío no dejan paneles', () => {