feat(tea): pestaña Evolución y paleta con el verde de ISSSTELEON
- Pestaña Evolución (solo TEA), entre Resumen y Seguimiento: una figura por indicador con todos los periodos publicados, mensual o semestral. Barras apiladas para C2, línea con intervalo de confianza para C1 y mediana con cuartiles para C3r. Los periodos suprimidos se sombrean, no se dibujan como cero. - Paleta: verde #A8C243 y rojo ladrillo #B8433A, comprobados para daltonismo. Las líneas usan un verde más oscuro sobre fondo claro. - «Sin EEG» conserva su color en M21 y M22. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,14 +31,16 @@ describe('Secciones compartidas por dominio', () => {
|
||||
});
|
||||
afterEach(() => { http.verify(); vi.restoreAllMocks(); vi.unstubAllGlobals(); });
|
||||
|
||||
it.each(DOMINIOS)('entrada directa en %s presenta tres pestañas y Resumen seleccionado', async domain => {
|
||||
it.each(DOMINIOS)('entrada directa en %s presenta sus pestañas y Resumen seleccionado', async domain => {
|
||||
const harness = await RouterTestingHarness.create();
|
||||
const page = await harness.navigateByUrl('/indicadores/' + domain, IndicadoresPage);
|
||||
http.expectOne('/' + domain + '/indicadores').flush(catalog); harness.detectChanges();
|
||||
const root = harness.routeNativeElement!;
|
||||
const tabs = Array.from(root.querySelectorAll<HTMLButtonElement>('[role="tab"]'));
|
||||
expect(tabs.map(t => t.textContent?.trim())).toEqual(['Resumen', 'Seguimiento', 'Datos y definiciones']);
|
||||
expect(tabs.map(t => t.getAttribute('aria-selected'))).toEqual(['true', 'false', 'false']);
|
||||
expect(tabs.map(t => t.textContent?.trim())).toEqual(domain === 'tea'
|
||||
? ['Resumen', 'Evolución', 'Seguimiento', 'Datos y definiciones'] : ['Resumen', 'Seguimiento', 'Datos y definiciones']);
|
||||
expect(tabs.map(t => t.getAttribute('aria-selected'))).toEqual(tabs.map((_, i) => String(i === 0)));
|
||||
const tab = (id: string) => tabs.find(t => t.id === 'tab-' + id)!;
|
||||
expect(root.querySelector('[role="tablist"]')?.getAttribute('aria-label')).toContain(page.domainLabels[domain]);
|
||||
// Upstream moved domain selection to its own App shell; ours keeps it on
|
||||
// the page itself (see indicadores-page.html), since our shell is shared
|
||||
@@ -50,7 +52,7 @@ describe('Secciones compartidas por dominio', () => {
|
||||
expect(panel.hidden).toBe(tab.id !== 'tab-resumen');
|
||||
}
|
||||
const cards = harness.routeDebugElement!.queryAll(By.directive(IndicadorCatalogCard)).map(e => e.componentInstance);
|
||||
tabs[1].click(); harness.detectChanges();
|
||||
tab('seguimiento').click(); harness.detectChanges();
|
||||
if (domain === 'cacu' || domain === 'tea') {
|
||||
http.expectOne(r => r.url === '/' + domain + '/seguimiento').flush({}, { status: 404, statusText: 'Pending' });
|
||||
harness.detectChanges();
|
||||
@@ -70,9 +72,9 @@ describe('Secciones compartidas por dominio', () => {
|
||||
expect(tracking.querySelector('tbody td')?.getAttribute('colspan')).toBe('6');
|
||||
expect(tracking.querySelectorAll('input,button,select')).toHaveLength(0);
|
||||
}
|
||||
tabs[2].click(); harness.detectChanges();
|
||||
tab('datos').click(); harness.detectChanges();
|
||||
expect(root.querySelector<HTMLElement>('#panel-datos')!.hidden).toBe(false);
|
||||
tabs[0].click(); harness.detectChanges();
|
||||
tab('resumen').click(); harness.detectChanges();
|
||||
expect(harness.routeDebugElement!.queryAll(By.directive(IndicadorCatalogCard)).map(e => e.componentInstance)).toEqual(cards);
|
||||
http.expectNone(() => true); // No patient, metadata, catalog or figure requests on section changes.
|
||||
});
|
||||
@@ -94,15 +96,15 @@ describe('Secciones compartidas por dominio', () => {
|
||||
const page = await harness.navigateByUrl('/indicadores/tea', IndicadoresPage);
|
||||
http.expectOne('/tea/indicadores').flush(catalog); harness.detectChanges();
|
||||
const tabs = Array.from(harness.routeNativeElement!.querySelectorAll<HTMLButtonElement>('[role="tab"]'));
|
||||
expect(tabs.map(t => t.tabIndex)).toEqual([0, -1, -1]);
|
||||
expect(tabs.map(t => t.tabIndex)).toEqual([0, -1, -1, -1]);
|
||||
const focus = tabs.map(tab => vi.spyOn(tab, 'focus'));
|
||||
function key(index: number, key: string, target: number) {
|
||||
const event = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true });
|
||||
tabs[index].dispatchEvent(event); expect(event.defaultPrevented).toBe(true);
|
||||
expect(focus[target]).toHaveBeenCalled(); expect(page.activeSection()).toBe('resumen');
|
||||
}
|
||||
key(0, 'ArrowRight', 1); key(0, 'ArrowLeft', 2); key(1, 'Home', 0); key(0, 'End', 2);
|
||||
tabs[2].click(); harness.detectChanges(); expect(tabs.map(t => t.tabIndex)).toEqual([-1, -1, 0]);
|
||||
key(0, 'ArrowRight', 1); key(0, 'ArrowLeft', 3); key(1, 'Home', 0); key(0, 'End', 3);
|
||||
tabs[3].click(); harness.detectChanges(); expect(tabs.map(t => t.tabIndex)).toEqual([-1, -1, -1, 0]);
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user