feat(indicadores): show full domain names and share CaMa's summary
CaCu and TEA use the same menu labels and compact summary layout as cáncer de mama. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -41,7 +41,7 @@ describe('Encabezado del marco', () => {
|
||||
const paths = routes.flatMap((ruta) => [ruta.path, ...(ruta.children ?? []).map((hijo) => hijo.path)]);
|
||||
for (const dominio of DOMINIOS) expect(paths).toContain(`indicadores/${dominio}`);
|
||||
});
|
||||
it.each([['tea', 'TEA'], ['cacu', 'CaCu'], ['cama', 'Cáncer de mama']] as const)('en /indicadores/%s muestra el título de la plataforma y el selector con «%s»', async (dominio, etiqueta) => {
|
||||
it.each([['tea', 'Trastorno del espectro autista'], ['cacu', 'Cáncer cervicouterino'], ['cama', 'Cáncer de mama']] as const)('en /indicadores/%s muestra el título de la plataforma y el selector con «%s»', async (dominio, etiqueta) => {
|
||||
await ir('/indicadores/' + dominio);
|
||||
expect(root().querySelector('.platform-title')?.textContent).toBe('Plataforma de Indicadores');
|
||||
expect(selector()?.textContent?.replace(/\s+/g, ' ').trim()).toBe(etiqueta + ' ▾');
|
||||
@@ -60,7 +60,7 @@ describe('Encabezado del marco', () => {
|
||||
it('el menú ofrece los otros dos dominios con sus rutas institucionales', async () => {
|
||||
await ir('/indicadores/cama');
|
||||
const items = await abrirMenu();
|
||||
expect(items.map(a => a.textContent?.trim())).toEqual(['TEA', 'CaCu']);
|
||||
expect(items.map(a => a.textContent?.trim())).toEqual(['Trastorno del espectro autista', 'Cáncer cervicouterino']);
|
||||
expect(items.map(a => a.getAttribute('href'))).toEqual(['/indicadores/tea', '/indicadores/cacu']);
|
||||
expect(selector()!.getAttribute('aria-expanded')).toBe('true');
|
||||
});
|
||||
@@ -69,7 +69,7 @@ describe('Encabezado del marco', () => {
|
||||
const items = await abrirMenu();
|
||||
items[1].click(); await fixture.whenStable(); fixture.detectChanges();
|
||||
expect(router.url).toBe('/indicadores/cacu');
|
||||
expect(selector()!.textContent).toContain('CaCu');
|
||||
expect(selector()!.textContent).toContain('Cáncer cervicouterino');
|
||||
// The choice is a router navigation (a history entry), not a page reload: going back lands on the previous domain.
|
||||
const ubicacion = TestBed.inject(Location);
|
||||
ubicacion.back(); await new Promise(r => setTimeout(r, 100));
|
||||
|
||||
+29
-6
@@ -117,7 +117,8 @@
|
||||
|
||||
.domain-selector--espera {
|
||||
align-items: center; border-radius: var(--issste-radius); box-sizing: border-box; display: inline-flex; flex: 0 0 auto;
|
||||
background-color: var(--issste-accent); color: var(--issste-text); font-weight: 700; min-height: 40px; padding: 0 16px; white-space: nowrap;
|
||||
max-width: 100%; background-color: var(--issste-accent); color: var(--issste-text); font-weight: 700; line-height: 1.2;
|
||||
min-height: 40px; padding: 0 16px; white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Session exit: the same action look as the home buttons, in header size. */
|
||||
@@ -160,9 +161,31 @@
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
// Narrow screens: logo and selector share the first row and the title takes the second, so neither is squeezed.
|
||||
@media (max-width: 599px) {
|
||||
.app-shell--indicadores .site-header__content { flex-wrap: wrap; row-gap: 0; padding-block: 6px 8px; }
|
||||
.app-shell--indicadores .brand { margin-inline-end: auto; }
|
||||
.platform-title { order: 3; flex: 1 0 100%; margin: 4px 0 0; font-size: 1.125rem; min-width: 0; }
|
||||
// Full domain names need their own track. On a wide header they sit beside the title;
|
||||
// below 900px the name takes a row of its own so the logo and the exit stay together.
|
||||
.app-shell--indicadores .site-header__content {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto auto;
|
||||
grid-template-areas: "brand title domain salir";
|
||||
align-items: center;
|
||||
column-gap: 16px;
|
||||
row-gap: 8px;
|
||||
padding-block: 8px;
|
||||
}
|
||||
.app-shell--indicadores .brand { grid-area: brand; }
|
||||
.app-shell--indicadores .platform-title { grid-area: title; margin: 0; overflow-wrap: normal; }
|
||||
.app-shell--indicadores .domain-selector,
|
||||
.app-shell--indicadores .domain-selector--espera { grid-area: domain; justify-self: end; }
|
||||
.app-shell--indicadores .site-header__salir { grid-area: salir; margin-inline-start: 0; }
|
||||
@media (max-width: 900px) {
|
||||
.app-shell--indicadores .site-header__content {
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
grid-template-areas:
|
||||
"brand salir"
|
||||
"domain domain"
|
||||
"title title";
|
||||
}
|
||||
.app-shell--indicadores .domain-selector,
|
||||
.app-shell--indicadores .domain-selector--espera { justify-self: start; white-space: normal; }
|
||||
.app-shell--indicadores .platform-title { font-size: 1.125rem; }
|
||||
}
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ describe('App', () => {
|
||||
it('el encabezado no ofrece los otros dominios', async () => {
|
||||
const page = await render('/indicadores/cacu');
|
||||
expect(page.querySelector('app-domain-selector')).toBeNull();
|
||||
expect(page.querySelector('.domain-selector--espera')?.textContent).toContain('CaCu');
|
||||
expect(page.querySelector('.domain-selector--espera')?.textContent).toContain('Cáncer cervicouterino');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+3
-1
@@ -38,7 +38,9 @@ export class App {
|
||||
|
||||
protected readonly usuario = this.auth.usuario;
|
||||
protected readonly title = 'Plataforma de Indicadores';
|
||||
protected readonly domainLabels: Record<Dominio, string> = { tea: 'TEA', cacu: 'CaCu', cama: 'Cáncer de mama' };
|
||||
protected readonly domainLabels: Record<Dominio, string> = {
|
||||
tea: 'Trastorno del espectro autista', cacu: 'Cáncer cervicouterino', cama: 'Cáncer de mama',
|
||||
};
|
||||
private readonly url = toSignal(this.router.events.pipe(
|
||||
filter((event) => event instanceof NavigationEnd), map(event => event.urlAfterRedirects)), { initialValue: this.router.url });
|
||||
/** On an indicators page the header names its domain and switches to the others. */
|
||||
|
||||
@@ -13,9 +13,9 @@ import { DataConnection, SourceTable } from '../domain/data-source';
|
||||
import { ImportFlow } from '../domain/import-flow';
|
||||
|
||||
export const DOMAINS: { id: Domain; label: string; description: string }[] = [
|
||||
{ id: 'cacu', label: 'CaCu', description: 'Cáncer cervicouterino' },
|
||||
{ id: 'cacu', label: 'Cáncer cervicouterino', description: 'Cáncer cervicouterino' },
|
||||
{ id: 'cama', label: 'Cáncer de mama', description: 'Cáncer de mama' },
|
||||
{ id: 'tea', label: 'TEA', description: 'Trastorno del espectro autista' },
|
||||
{ id: 'tea', label: 'Trastorno del espectro autista', description: 'Trastorno del espectro autista' },
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
:host { display: contents; }
|
||||
.domain-selector {
|
||||
flex: 0 0 auto;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
min-height: 40px;
|
||||
background-color: var(--issste-accent);
|
||||
color: var(--issste-text);
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.domain-selector { white-space: normal; text-align: start; padding-block: 8px; }
|
||||
}
|
||||
.domain-selector:hover { background-color: var(--issste-accent); filter: brightness(.94); }
|
||||
.domain-selector:focus-visible { outline: 2px solid var(--issste-text); outline-offset: 2px; }
|
||||
|
||||
@@ -36,7 +36,8 @@ describe('UX-06E.D.2.1 selector de representación', () => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('h2').textContent).toBe('EEG con ≥ 20 min de registro');
|
||||
expect(fixture.nativeElement.querySelector('.indicator-id')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('.catalog-metadata').textContent.trim()).toBe('2 figuras publicadas');
|
||||
expect(fixture.nativeElement.querySelector('.catalog-metadata')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('.pin-toggle')).toBeNull();
|
||||
// The internal panel heading is deliberately visually hidden and retains identity.
|
||||
const copy = fixture.nativeElement.cloneNode(true) as HTMLElement;
|
||||
copy.querySelectorAll('.visually-hidden').forEach(node => node.remove());
|
||||
|
||||
@@ -135,8 +135,8 @@ export class IndicadorCatalogCard implements OnChanges, OnDestroy {
|
||||
if (this.indicador && this.applied) untracked(() => this.updateNumeric());
|
||||
});
|
||||
}
|
||||
// CaMa's cards carry no pin, representation selector or figure count, as in the mockup.
|
||||
get sobrio() { return this.dominio === 'cama'; }
|
||||
// Every domain follows CaMa's mockup: no pin, representation selector or figure count.
|
||||
get sobrio() { return true; }
|
||||
get pair() { return dualFigures(this.indicador); }
|
||||
get isEu7() { return this.dominio === 'cacu' && this.indicador.id === 'cacu_eu7'; }
|
||||
get isConfirmacion() { return this.dominio === 'cacu' && this.indicador.id === ID_CONFIRMACION; }
|
||||
|
||||
@@ -37,10 +37,9 @@ import { MatCardModule } from '@angular/material/card';
|
||||
clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
||||
.value { font-size: 1.75rem; font-weight: 500; line-height: 1.2; }
|
||||
.value span { margin-inline-start: .3em; }
|
||||
// CaMa's cards are as tall as their grid row.
|
||||
:host-context(.kpi-section[data-domain='cama']) { display: flex; flex-direction: column; }
|
||||
:host-context(.kpi-section[data-domain='cama']) mat-card { flex: 1 1 auto; height: auto; }
|
||||
:host-context(.kpi-section[data-domain='cama']) .value { font-size: 1.65rem; }
|
||||
:host-context(.kpi-section) { display: flex; flex-direction: column; }
|
||||
:host-context(.kpi-section) mat-card { flex: 1 1 auto; height: auto; }
|
||||
:host-context(.kpi-section) .value { font-size: 1.65rem; }
|
||||
`,
|
||||
})
|
||||
export class IndicadorKpiCard {
|
||||
@@ -48,7 +47,7 @@ export class IndicadorKpiCard {
|
||||
@Input() value?: string | number | null;
|
||||
@Input() unit?: string;
|
||||
@Input() temporalReference?: string;
|
||||
// CaMa's opportunity strip shares one period, shown by the parent instead of on every card.
|
||||
// The opportunity strip shares one period, shown by the parent instead of on every card.
|
||||
@Input() showPeriod = true;
|
||||
@Input() loading = false;
|
||||
@Input() notes: string[] = [];
|
||||
|
||||
@@ -39,7 +39,8 @@ describe('KPI búsqueda inicial del último dato visible', () => {
|
||||
latest.flush(data(periods[0], 'suppressed'));
|
||||
request(periods[1]).flush(data(periods[1])); fixture.detectChanges();
|
||||
expect(fixture.componentInstance.result().value).toBe(5);
|
||||
expect(fixture.nativeElement.textContent).toContain('Último dato visible, 2025-S1');
|
||||
expect(fixture.componentInstance.temporalReference).toBe('Último dato visible, 2025-S1');
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Último dato visible');
|
||||
expect(fixture.nativeElement.textContent).toContain('Existen reportes posteriores con datos ocultos por tamaño.');
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
|
||||
@@ -192,12 +192,9 @@ describe('KPI integración con autoridad global', () => {
|
||||
expect(cards.map(card => card.textContent)).toEqual(expect.arrayContaining([
|
||||
expect.stringContaining(domain === 'cacu' ? '5 citologías; primer cuartil: 3 días; tercer cuartil: 9 días.' : '5 mastografías; Q1 a Q3: 3 a 9 días.'),
|
||||
]));
|
||||
if (domain === 'cama') {
|
||||
expect(fixture.nativeElement.querySelector('.kpi-period')?.textContent).toBe('Periodo 2025-S1');
|
||||
expect(cards.every(card => !card.textContent?.includes('2025-S1'))).toBe(true);
|
||||
} else {
|
||||
expect(cards.map(card => card.textContent)).toEqual(expect.arrayContaining([expect.stringContaining('2025-S1')]));
|
||||
}
|
||||
expect(fixture.nativeElement.querySelector('.kpi-period')?.textContent).toBe('Periodo 2025-S1');
|
||||
expect(cards.every(card => !card.textContent?.includes('2025-S1'))).toBe(true);
|
||||
expect(cards.filter(card => card.querySelector('.value')).every(card => card.querySelector('.kpi-state')?.classList.contains('visually-hidden'))).toBe(true);
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Definición provisional');
|
||||
// CaCu and CaMa cards say only their own line, as in the reference; the kit notes are the figure footer and the definitions.
|
||||
expect(fixture.nativeElement.textContent.includes('Nota del pie de la figura.')).toBe(false);
|
||||
|
||||
@@ -19,15 +19,15 @@ interface KpiDisplay extends KpiResult { period?: string; earlier?: boolean; ver
|
||||
imports: [IndicadorKpiCard, MatButtonModule],
|
||||
template: `<app-indicador-kpi-card [title]="definition.title" [value]="result().value" [unit]="definition.unit"
|
||||
[state]="result().state" [additionalInfo]="result().info" [temporalReference]="temporalReference"
|
||||
[loading]="result().loading ?? false" [notes]="dominio === 'tea' ? result().notes ?? [] : []" [quietWhenAvailable]="dominio === 'cama'"
|
||||
[showPeriod]="dominio !== 'cama'" />
|
||||
[loading]="result().loading ?? false" [notes]="dominio === 'tea' ? result().notes ?? [] : []" [quietWhenAvailable]="true"
|
||||
[showPeriod]="false" />
|
||||
@if (result().state === 'Error de consulta') {
|
||||
<button type="button" mat-stroked-button (click)="retry()" [attr.aria-label]="'Reintentar ' + definition.title">Reintentar consulta</button>
|
||||
}`,
|
||||
styles: `
|
||||
:host { display: block; min-width: 0; }
|
||||
:host-context(.kpi-section[data-domain='cama']) { display: flex; flex-direction: column; }
|
||||
:host-context(.kpi-section[data-domain='cama']) app-indicador-kpi-card { flex: 1 1 auto; }
|
||||
:host-context(.kpi-section) { display: flex; flex-direction: column; }
|
||||
:host-context(.kpi-section) app-indicador-kpi-card { flex: 1 1 auto; }
|
||||
`,
|
||||
})
|
||||
export class IndicadorKpiPanel implements OnChanges {
|
||||
|
||||
@@ -101,12 +101,12 @@ describe('CaCu: oportunidad y selección independiente de todos los reportes', (
|
||||
expect(original.map(i => i.id)).toEqual(catalog.map(i => i.id));
|
||||
expect(before[0].indicador.id).toBe('cacu_eu7');
|
||||
page.togglePinned(original[0]); fixture.detectChanges();
|
||||
expect(cards()[0]).toBe(card('cacu_eu13'));
|
||||
expect(cards()[0]).toBe(card('cacu_eu7'));
|
||||
page.changeIndicatorSelection(['ind1', 'cacu_eu13']); fixture.detectChanges();
|
||||
expect(cards().map(c => c.indicador.id)).toEqual(['cacu_eu13', 'ind1']);
|
||||
for (const id of ['ind1', 'cacu_eu13']) expect(card(id)).toBe(before.find(c => c.indicador.id === id));
|
||||
page.showAllIndicators(); fixture.detectChanges();
|
||||
expect(cards()[0].indicador.id).toBe('cacu_eu13');
|
||||
expect(cards()[0].indicador.id).toBe('cacu_eu7');
|
||||
expect(page.catalog()).toBe(original);
|
||||
expect(TestBed.inject(IndicadoresMemory).isPinned('cacu', 'cacu_eu13')).toBe(true);
|
||||
http.expectNone(() => true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Covers the clinical section of CaMa's summary: its heading and counter, and the controls the mockup does not
|
||||
// have (search, pins, floating navigation, representation selector, figure count), which CaCu and TEA keep.
|
||||
// Covers the clinical section: its heading, and the controls the mockup does not have
|
||||
// (search, pins, floating navigation, representation selector, figure count) in every domain.
|
||||
// Fixtures are catalogs shaped like /<dominio>/indicadores; no figure is requested (the cards stay out of view).
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
@@ -113,18 +113,14 @@ describe('Resumen clínico de CaMa y los demás dominios', () => {
|
||||
fixture.componentInstance.togglePinned(CAMA[5] as never); fixture.detectChanges();
|
||||
expect(titles()).toEqual(before);
|
||||
});
|
||||
it.each(['tea', 'cacu'] as const)('%s conserva buscador, fijados y conteo de figuras', domain => {
|
||||
// Fails if CaMa's simplified section leaks into the other domains.
|
||||
it.each(['tea', 'cacu'] as const)('%s usa el mismo resumen clínico que CaMa: sin buscador, fijados ni conteo de figuras', domain => {
|
||||
open(domain, OTRO(domain));
|
||||
expect(root().querySelector('.catalog-search')).not.toBeNull();
|
||||
expect(root().querySelectorAll('.pin-toggle').length).toBe(6);
|
||||
expect(section().textContent).toContain('2 figuras publicadas');
|
||||
expect(root().querySelector('#graphic-section-title')?.textContent).toBe('Indicadores clínicos');
|
||||
expect(root().querySelector('#dashboard-title')?.textContent?.trim()).toBe(domain === 'tea' ? 'Trastorno del espectro autista' : 'Cáncer cervicouterino');
|
||||
expect(root().querySelector('header .domain')).toBeNull();
|
||||
expect(root().querySelector('.catalog-search')).toBeNull();
|
||||
expect(root().querySelector('.pin-toggle')).toBeNull();
|
||||
expect(section().textContent).not.toContain('figuras publicadas');
|
||||
expect(root().textContent).not.toContain('indicadores publicados');
|
||||
});
|
||||
it('CaCu conserva su encabezado «Indicadores clínicos» y TEA «Indicadores gráficos»', () => {
|
||||
open('cacu', OTRO('cacu'));
|
||||
expect(root().querySelector('#graphic-section-title')?.textContent).toBe('Indicadores clínicos');
|
||||
open('tea', OTRO('tea'));
|
||||
expect(root().querySelector('#graphic-section-title')?.textContent).toBe('Indicadores gráficos');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -33,8 +33,7 @@ describe('Cambio de dominio con consultas pendientes', () => {
|
||||
fixture.detectChanges();
|
||||
expect(text()).not.toContain('Indicador de CaMa');
|
||||
});
|
||||
it('los controles propios de cada dominio se conservan al ir y volver', () => {
|
||||
// CaCu keeps its multiple selection, search and pins; CaMa does not have them; neither state contaminates the other.
|
||||
it('el resumen clínico es el mismo al ir y volver, y el catálogo no se mezcla', () => {
|
||||
const abrir = (d: 'cacu' | 'cama', n: number) => {
|
||||
fixture.componentInstance.changeDominio(d); fixture.detectChanges();
|
||||
http.expectOne('/' + d + '/indicadores').flush(Array.from({ length: n }, (_, i) => item(`${d}_${i}`, `${d} ${i}`, 'C2'))); fixture.detectChanges();
|
||||
@@ -42,8 +41,9 @@ describe('Cambio de dominio con consultas pendientes', () => {
|
||||
};
|
||||
const el = () => fixture.nativeElement as HTMLElement;
|
||||
abrir('cacu', 6);
|
||||
expect(el().querySelector('.catalog-search')).not.toBeNull();
|
||||
expect(el().querySelectorAll('.pin-toggle').length).toBe(6);
|
||||
expect(el().querySelector('.catalog-search')).toBeNull();
|
||||
expect(el().querySelector('.pin-toggle')).toBeNull();
|
||||
expect(el().querySelector('#dashboard-title')?.textContent?.trim()).toBe('Cáncer cervicouterino');
|
||||
expect(el().textContent).toContain('Intervalo de análisis');
|
||||
abrir('cama', 6);
|
||||
expect(el().querySelector('.catalog-search')).toBeNull();
|
||||
@@ -51,9 +51,8 @@ describe('Cambio de dominio con consultas pendientes', () => {
|
||||
expect(el().textContent).not.toContain('Buscar indicadores');
|
||||
expect(el().textContent).not.toContain('cacu_');
|
||||
abrir('cacu', 6);
|
||||
// On the way back the page state (not only the DOM) says CaCu has its search again.
|
||||
expect(fixture.componentInstance.dominio).toBe('cacu');
|
||||
expect(fixture.componentInstance.searchVisible()).toBe(true);
|
||||
expect(fixture.componentInstance.searchVisible()).toBe(false);
|
||||
expect(el().textContent).toContain('Intervalo de análisis');
|
||||
expect(el().textContent).not.toContain('cama_');
|
||||
});
|
||||
|
||||
@@ -19,7 +19,9 @@ export class IndicadoresDefinitions {
|
||||
@Input() loading = false;
|
||||
@Input() error = '';
|
||||
readonly retry = output<void>();
|
||||
readonly domainNames: Record<Dominio, string> = { tea: 'TEA', cacu: 'cáncer cervicouterino', cama: 'cáncer de mama' };
|
||||
readonly domainNames: Record<Dominio, string> = {
|
||||
tea: 'trastorno del espectro autista', cacu: 'cáncer cervicouterino', cama: 'cáncer de mama',
|
||||
};
|
||||
readonly periodNames: Record<TipoPeriodo, string> = { semestre: 'Semestral', mes: 'Mensual' };
|
||||
readonly figureDisplayName = figureDisplayName;
|
||||
readonly periodInterpretation = PERIOD_INTERPRETATION;
|
||||
|
||||
@@ -62,7 +62,7 @@ function agrupar(paneles: (Panel & { datos?: IndicadorDatos })[], tema: Tema): P
|
||||
selector: 'app-indicadores-historico',
|
||||
imports: [MatButtonModule, MatButtonToggleModule, MatFormFieldModule, MatProgressBarModule, MatSelectModule, PlotlyChart],
|
||||
template: `
|
||||
<div class="controles" [class.compacto]="dominio() === 'cama'">
|
||||
<div class="controles compacto">
|
||||
<h2>Filtros</h2>
|
||||
<div class="controles-fila">
|
||||
<div class="interval">
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<h1 id="dashboard-title">Ficha del paciente</h1>
|
||||
<p>Consulta individual de seguimiento de {{ domainLabels[dominio] }}</p>
|
||||
} @else {
|
||||
@if (dominio !== 'cama') { <span class="domain">{{ domainTitles[dominio] }}, investigación</span> }
|
||||
<h1 id="dashboard-title">{{ dominio === 'cama' ? 'Cáncer de mama' : 'Indicadores' }}</h1>
|
||||
<h1 id="dashboard-title">{{ domainTitles[dominio] }}</h1>
|
||||
<p>Explora los indicadores de {{ domainLabels[dominio] }}.</p>
|
||||
}
|
||||
</header>
|
||||
@@ -23,10 +22,7 @@
|
||||
@if (!catalogLoading() && filters; as state) {
|
||||
<section class="global-filters" aria-labelledby="global-filters-title" [attr.data-domain]="dominio">
|
||||
<h2 id="global-filters-title" class="section-title">Filtros</h2>
|
||||
@if (dominio !== 'cama') {
|
||||
<p class="section-description">{{ dominio === 'cacu' ? 'La selección se aplica a los indicadores de oportunidad y las gráficas, salvo las que indican selección independiente: Todos con reporte.' : 'La selección aplicada se comparte entre las figuras y los indicadores destacados de este proyecto.' }}</p>
|
||||
}
|
||||
<app-indicador-period-filters [state]="state" [compact]="dominio === 'cama'" [types]="filterTypes()" [availability]="availability()" [initialPresentation]="initialPeriodBlocked"
|
||||
<app-indicador-period-filters [state]="state" [compact]="true" [types]="filterTypes()" [availability]="availability()" [initialPresentation]="initialPeriodBlocked"
|
||||
(retryAvailability)="retryAvailability()"
|
||||
(edited)="editFilters()" (apply)="applyFilters()" />
|
||||
</section>
|
||||
@@ -51,7 +47,7 @@
|
||||
<section class="kpi-section" aria-labelledby="kpi-section-title" [attr.data-domain]="dominio">
|
||||
@let resumen = teaResumenPeriodo;
|
||||
<div class="kpi-heading">
|
||||
<h2 id="kpi-section-title" class="section-title">{{ dominio === 'cacu' || dominio === 'cama' ? 'Indicadores de oportunidad' : resumen ? 'Resumen' : 'Indicadores destacados' }}</h2>
|
||||
<h2 id="kpi-section-title" class="section-title">Indicadores de oportunidad</h2>
|
||||
@if (periodoCompartido) { <p class="kpi-period">Periodo {{ periodoCompartido }}</p> }
|
||||
</div>
|
||||
@if (resumen) { <app-tea-resumen-periodo [periodo]="resumen" [paneles]="kpiPanels()" /> }
|
||||
@@ -79,7 +75,7 @@
|
||||
|
||||
<section class="graphic-section" aria-labelledby="graphic-section-title">
|
||||
<div class="catalog-heading">
|
||||
<h2 id="graphic-section-title" class="section-title">{{ dominio === 'cacu' || dominio === 'cama' ? 'Indicadores clínicos' : 'Indicadores gráficos' }}</h2>
|
||||
<h2 id="graphic-section-title" class="section-title">Indicadores clínicos</h2>
|
||||
</div>
|
||||
@if (catalogLoading()) {
|
||||
<mat-progress-bar mode="indeterminate" aria-label="Cargando catálogo" />
|
||||
|
||||
@@ -6,11 +6,8 @@
|
||||
.dashboard { max-width: 1680px; margin: 0 auto; min-width: 0; container: dashboard / inline-size; }
|
||||
h1 { font-family: var(--issste-font-heading); font-size: 1.75rem; font-weight: 500; line-height: 1.25; letter-spacing: 0; margin: .5rem 0; }
|
||||
header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; }
|
||||
.domain { color: var(--mat-sys-primary); font: var(--mat-sys-label-large); }
|
||||
.state { padding: 1.25rem; margin: 0; }
|
||||
// CaMa's filter block is one compact row, as in the reference.
|
||||
.global-filters[data-domain='cama'] { margin-block: var(--issste-space-4); padding: var(--issste-space-3) var(--issste-space-4); }
|
||||
.global-filters[data-domain='cama'] .section-title { font-size: 1rem; margin-bottom: var(--issste-space-3); }
|
||||
.global-filters .section-title { font-size: 1rem; margin-bottom: var(--issste-space-3); }
|
||||
.section-title { font-family: var(--issste-font-heading); font-size: 1.25rem; font-weight: 500; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
|
||||
.section-description { color: var(--issste-text-secondary); margin: var(--issste-space-2) 0 var(--issste-space-4); overflow-wrap: anywhere; }
|
||||
.kpi-section, .graphic-section { box-sizing: border-box; min-width: 0; margin-inline: var(--space-2);
|
||||
@@ -39,16 +36,12 @@ header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; }
|
||||
h1 { font-size: 1.5rem; }
|
||||
}
|
||||
|
||||
.global-filters { margin-block: var(--issste-space-6); padding: clamp(.75rem, 2vw, 1.5rem); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); background: var(--issste-surface); min-width: 0; }
|
||||
.global-filters { margin-block: var(--issste-space-4); padding: var(--issste-space-3) var(--issste-space-4); border: 1px solid var(--issste-border); border-radius: var(--issste-radius); background: var(--issste-surface); min-width: 0; }
|
||||
|
||||
@container dashboard (min-width: 1000px) { .kpi-grid { grid-template-columns: repeat(min(3, var(--kpi-count)), minmax(0, 1fr)); } }
|
||||
|
||||
.kpi-section[data-domain='cama'] .kpi-grid { grid-auto-rows: 1fr; }
|
||||
@container dashboard (min-width: 1350px) { .kpi-section[data-domain='cama'] .kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
|
||||
.kpi-section[data-domain='cacu'] .kpi-grid {
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
|
||||
align-items: stretch;
|
||||
}
|
||||
.kpi-section .kpi-grid { grid-auto-rows: 1fr; }
|
||||
@container dashboard (min-width: 1350px) { .kpi-section .kpi-grid { grid-template-columns: repeat(min(5, var(--kpi-count)), minmax(0, 1fr)); } }
|
||||
|
||||
.section-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--issste-space-1);
|
||||
border-block-start: 2px solid var(--issste-accent); border-block-end: 1px solid var(--issste-border);
|
||||
|
||||
@@ -54,15 +54,15 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
|
||||
});
|
||||
it('cambia al encabezado de ficha sin destruir el estado de las pestañas', () => {
|
||||
load();
|
||||
expect(fixture.nativeElement.querySelector('#dashboard-title')?.textContent.trim()).toBe('Indicadores');
|
||||
expect(fixture.nativeElement.querySelector('#dashboard-title')?.textContent.trim()).toBe('Trastorno del espectro autista');
|
||||
expect(fixture.nativeElement.querySelectorAll('.section-tabs [role="tab"]')).toHaveLength(4);
|
||||
fixture.debugElement.query(By.directive(IndicadoresTracking)).componentInstance.fichaPacienteAbierta.emit(true); fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('#dashboard-title')?.textContent.trim()).toBe('Ficha del paciente');
|
||||
expect(fixture.nativeElement.textContent).toContain('Consulta individual de seguimiento de TEA');
|
||||
expect(fixture.nativeElement.textContent).toContain('Consulta individual de seguimiento de trastorno del espectro autista');
|
||||
expect(fixture.nativeElement.querySelector('.section-tabs')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('#panel-seguimiento')?.getAttribute('aria-labelledby')).toBe('dashboard-title');
|
||||
fixture.debugElement.query(By.directive(IndicadoresTracking)).componentInstance.fichaPacienteAbierta.emit(false); fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('#dashboard-title')?.textContent.trim()).toBe('Indicadores');
|
||||
expect(fixture.nativeElement.querySelector('#dashboard-title')?.textContent.trim()).toBe('Trastorno del espectro autista');
|
||||
expect(fixture.nativeElement.querySelectorAll('.section-tabs [role="tab"]')).toHaveLength(4);
|
||||
expect(fixture.nativeElement.querySelector('#panel-seguimiento')?.getAttribute('aria-labelledby')).toBe('tab-seguimiento');
|
||||
expect(page.activeSection()).toBe('resumen');
|
||||
@@ -107,7 +107,8 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
|
||||
expect(host.querySelector('mat-select')).toBeNull();
|
||||
expect(host.querySelector('.figure-skeleton').textContent).toContain('pendiente');
|
||||
expect(host.textContent).not.toContain('Contrato C1');
|
||||
expect(host.querySelector('.catalog-metadata').textContent.trim()).toBe('2 figuras publicadas');
|
||||
expect(host.querySelector('.catalog-metadata')).toBeNull();
|
||||
expect(host.querySelector('.pin-toggle')).toBeNull();
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('Resumen omite los indicadores publicados solo para otra pestaña', () => {
|
||||
@@ -122,7 +123,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
|
||||
const header = host.querySelector('header'); toggle(); flushAll();
|
||||
const panel = panels()[0]; cards()[0].setVisible(false); fixture.detectChanges();
|
||||
expect(host.querySelector('header')).toBe(header); expect(panels()[0]).toBe(panel);
|
||||
expect(host.querySelector('.catalog-metadata')).toBeTruthy(); http.expectNone(() => true);
|
||||
expect(host.querySelector('.catalog-metadata')).toBeNull(); http.expectNone(() => true);
|
||||
});
|
||||
it('UX-06C: conserva título largo completo y el control separado de la identidad', () => {
|
||||
const title = 'Distribución de indicadores con un título extenso y múltiples palabras para revisión responsive';
|
||||
@@ -131,7 +132,7 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
|
||||
expect(header.querySelector('h2')?.textContent).toBe(title);
|
||||
expect(header.querySelector('.card-identity button')).toBeNull();
|
||||
expect(header.querySelector('button')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelector('.pin-toggle').getAttribute('aria-label')).toContain(title);
|
||||
expect(fixture.nativeElement.querySelector('.pin-toggle')).toBeNull();
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('UX-06B la navegación entre dominios es la del encabezado: la página no la duplica', () => {
|
||||
@@ -324,7 +325,8 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
|
||||
toggle(index); toggle(index); flushAll(); await fixture.whenStable();
|
||||
expect(control().entry.draft.mode).toBe('empty'); expect(control().state.applied?.selection.mode).toBe('todos');
|
||||
const state = panels()[0].result(); const saves = vi.spyOn(TestBed.inject(IndicadoresMemory), 'saveGlobal');
|
||||
const select = fixture.debugElement.queryAll(By.directive(MatSelect)).find(e => e.componentInstance.multiple)!;
|
||||
expect(fixture.debugElement.queryAll(By.directive(MatSelect)).some(e => e.componentInstance.multiple)).toBe(false);
|
||||
const select = fixture.debugElement.query(By.directive(MatSelect));
|
||||
const writes = vi.spyOn(select.injector.get(NgModel).control, 'setValue');
|
||||
for (let i = 0; i < 3; i++) {
|
||||
select.componentInstance.open(); fixture.detectChanges(); await fixture.whenStable();
|
||||
|
||||
@@ -104,7 +104,6 @@ export class IndicadoresPage {
|
||||
readonly kpiPanels = viewChildren(IndicadorKpiPanel);
|
||||
// The opportunity cards share the period their own query already resolved.
|
||||
get periodoCompartido(): string {
|
||||
if (this.dominio !== 'cama') return '';
|
||||
const deConsulta = this.kpiPanels().map(panel => panel.temporalReference.trim())
|
||||
.find(text => /^\d{4}-(?:S[12]|0[1-9]|1[0-2])$/.test(text));
|
||||
if (deConsulta) return deConsulta;
|
||||
@@ -302,9 +301,12 @@ export class IndicadoresPage {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly route = inject(ActivatedRoute, { optional: true });
|
||||
dominio: Dominio = 'tea';
|
||||
readonly domainLabels: Record<Dominio, string> = { tea: 'TEA', cacu: 'cáncer cervicouterino', cama: 'cáncer de mama' };
|
||||
// At the start of the header line.
|
||||
readonly domainTitles: Record<Dominio, string> = { ...this.domainLabels, cacu: 'Cáncer cervicouterino', cama: 'Cáncer de mama' };
|
||||
readonly domainLabels: Record<Dominio, string> = {
|
||||
tea: 'trastorno del espectro autista', cacu: 'cáncer cervicouterino', cama: 'cáncer de mama',
|
||||
};
|
||||
readonly domainTitles: Record<Dominio, string> = {
|
||||
tea: 'Trastorno del espectro autista', cacu: 'Cáncer cervicouterino', cama: 'Cáncer de mama',
|
||||
};
|
||||
readonly kpisByDomain = { ...KPI_BY_DOMAIN, tea: [...KPI_BY_DOMAIN.tea, ...KPI_RESUMEN_TEA] };
|
||||
figureApplied(item: Indicador) { return figureApplied(this.dominio, item.id, this.filters!.applied); }
|
||||
independentPeriods(item: Indicador) { return independentFigurePeriods(this.dominio, item.id); }
|
||||
@@ -356,9 +358,9 @@ export class IndicadoresPage {
|
||||
readonly catalog = signal<Indicador[]>([]);
|
||||
// Ids of the indicators to render; null shows the whole catalog.
|
||||
readonly indicatorSelection = signal<string[] | null>(null);
|
||||
// CaMa follows the mockup: no search box and no pins; its cards are the ones the summary draws.
|
||||
readonly searchVisible = computed(() => { const total = this.catalogOrder().length; return this.dominio !== 'cama' && total >= 2; });
|
||||
// Stable presentation priority; pins still take precedence in the grid.
|
||||
// The summary follows CaMa's mockup: no search box and no pins in any domain.
|
||||
readonly searchVisible = computed(() => false);
|
||||
// Stable presentation order. Pins no longer reorder the summary.
|
||||
readonly catalogOrder = computed(() => {
|
||||
const catalog = this.catalog();
|
||||
return this.dominio === 'cacu'
|
||||
@@ -375,8 +377,7 @@ export class IndicadoresPage {
|
||||
});
|
||||
readonly searchResults = computed(() => {
|
||||
const selected = new Set(this.selectedIndicators());
|
||||
const items = this.catalogOrder().filter(item => selected.has(item.id));
|
||||
return { items: [...items.filter(item => this.isPinned(item)), ...items.filter(item => !this.isPinned(item))] };
|
||||
return { items: this.catalogOrder().filter(item => selected.has(item.id)) };
|
||||
});
|
||||
readonly catalogLoading = signal(true);
|
||||
readonly catalogError = signal('');
|
||||
|
||||
@@ -97,14 +97,17 @@ describe('P0.1 selección publicada y último periodo por KPI', () => {
|
||||
const control = editor(); control.changeTipo('mes'); control.select(['2025-10']); fixture.detectChanges();
|
||||
expect(control.options).toEqual(['2026-01', '2025-10', '2025-02']);
|
||||
expect(fixture.nativeElement.querySelector('.period-builder')).toBeNull();
|
||||
expect(fixture.nativeElement.textContent).toContain('Existe reporte en al menos un indicador');
|
||||
expect(fixture.nativeElement.querySelector('.fields.compact')).not.toBeNull();
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Existe reporte en al menos un indicador');
|
||||
expect(fixture.componentInstance.filters!.applied.selection.mode).toBe('todos'); http.expectNone(() => true);
|
||||
fixture.componentInstance.applyFilters(); fixture.detectChanges();
|
||||
const single = flushDatos('cacu'); expect(single).toHaveLength(2);
|
||||
expect(single.every(r => r.request.params.get('periodos') === '2025-10')).toBe(true);
|
||||
control.select(['2025-10', '2025-02']); fixture.detectChanges(); http.expectNone(() => true);
|
||||
expect(control.selectedPeriods).toEqual(['2025-10']);
|
||||
expect(control.selectedPeriods).toEqual(['2025-02']);
|
||||
fixture.componentInstance.applyFilters(); fixture.detectChanges();
|
||||
const replaced = flushDatos('cacu');
|
||||
expect(replaced.every(r => r.request.params.get('periodos') === '2025-02')).toBe(true);
|
||||
expect(panels().every(p => p.result().state !== 'Selección no consolidable')).toBe(true);
|
||||
http.expectNone(() => true);
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -35,46 +35,40 @@ describe('UX-06E.D.3.B fijación temporal', () => {
|
||||
function cards() { return fixture.debugElement.queryAll(By.directive(IndicadorCatalogCard)).map(e => e.componentInstance as IndicadorCatalogCard); }
|
||||
function card(id: string) { return cards().find(c => c.indicador.id === id)!; }
|
||||
function ids() { return cards().map(c => c.indicador.id); }
|
||||
function button(id: string): HTMLButtonElement { return card(id).host.nativeElement.querySelector('.pin-toggle')!; }
|
||||
async function settle() { await fixture.whenStable(); for (let i = 0; i < 12; i++) await Promise.resolve(); fixture.detectChanges(); }
|
||||
async function pin(id: string) { button(id).click(); fixture.detectChanges(); await settle(); }
|
||||
async function pin(id: string) { page.togglePinned(card(id).indicador); fixture.detectChanges(); await settle(); }
|
||||
function respond() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [1] }], layout: {} })); fixture.detectChanges(); }
|
||||
|
||||
it('fija y desfija con control nativo, texto, estado accesible y sin HTTP', async () => {
|
||||
const control = button('i3');
|
||||
expect(control.type).toBe('button'); expect(control.tabIndex).toBe(0);
|
||||
expect(control.textContent).toContain('Fijar indicador'); expect(control.getAttribute('aria-pressed')).toBe('false');
|
||||
expect(control.getAttribute('aria-label')).toContain('Fijar indicador');
|
||||
for (const key of ['Enter', ' ']) {
|
||||
const event = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true });
|
||||
control.dispatchEvent(event); expect(event.defaultPrevented).toBe(false);
|
||||
}
|
||||
await pin('i3'); expect(ids()).toEqual(['i3', 'i0', 'i1', 'i2', 'i4']);
|
||||
expect(button('i3')).toBe(control); expect(control.getAttribute('aria-pressed')).toBe('true');
|
||||
expect(control.textContent).toContain('Desfijar indicador'); expect(control.getAttribute('aria-label')).toContain('Desfijar indicador');
|
||||
await pin('i3'); expect(ids()).toEqual(items.map(i => i.id)); expect(control.getAttribute('aria-pressed')).toBe('false');
|
||||
it('no muestra el control de fijar y la memoria no reordena las tarjetas', async () => {
|
||||
expect(fixture.nativeElement.querySelector('.pin-toggle')).toBeNull();
|
||||
await pin('i3');
|
||||
expect(TestBed.inject(IndicadoresMemory).isPinned('tea', 'i3')).toBe(true);
|
||||
expect(ids()).toEqual(items.map(i => i.id));
|
||||
await pin('i3');
|
||||
expect(TestBed.inject(IndicadoresMemory).isPinned('tea', 'i3')).toBe(false);
|
||||
expect(ids()).toEqual(items.map(i => i.id));
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('varios fijados conservan orden del catálogo, independientemente del orden de clics', async () => {
|
||||
it('varios fijados no alteran el orden del catálogo', async () => {
|
||||
const original = page.catalog(), snapshot = JSON.stringify(original);
|
||||
await pin('i4'); await pin('i2'); await pin('i0');
|
||||
expect(ids()).toEqual(['i0', 'i2', 'i4', 'i1', 'i3']);
|
||||
await pin('i2'); expect(ids()).toEqual(['i0', 'i4', 'i1', 'i2', 'i3']);
|
||||
await pin('i2'); expect(ids()).toEqual(['i0', 'i2', 'i4', 'i1', 'i3']);
|
||||
expect(ids()).toEqual(items.map(i => i.id));
|
||||
await pin('i2'); expect(ids()).toEqual(items.map(i => i.id));
|
||||
expect(page.catalog()).toBe(original); expect(JSON.stringify(original)).toBe(snapshot); http.expectNone(() => true);
|
||||
});
|
||||
it('la selección de indicadores conserva la prioridad de los fijados', async () => {
|
||||
it('la selección de indicadores conserva el orden del catálogo', async () => {
|
||||
await pin('i3'); await pin('i4');
|
||||
page.changeIndicatorSelection(['i1', 'i3', 'i4']); fixture.detectChanges(); await settle();
|
||||
expect(ids()).toEqual(['i3', 'i4', 'i1']);
|
||||
expect(ids()).toEqual(['i1', 'i3', 'i4']);
|
||||
await pin('i1'); expect(ids()).toEqual(['i1', 'i3', 'i4']);
|
||||
expect(cards()).toHaveLength(3); http.expectNone(() => true);
|
||||
});
|
||||
it('Mostrar todos restaura el catálogo con los fijados primero', async () => {
|
||||
it('Mostrar todos restaura el catálogo en su orden', async () => {
|
||||
await pin('i3'); page.changeIndicatorSelection(['i0']); fixture.detectChanges(); await settle();
|
||||
expect(ids()).toEqual(['i0']);
|
||||
fixture.nativeElement.querySelector('.catalog-search button').click(); fixture.detectChanges(); await settle();
|
||||
expect(page.indicatorSelection()).toBeNull(); expect(ids()).toEqual(['i3', 'i0', 'i1', 'i2', 'i4']); http.expectNone(() => true);
|
||||
expect(fixture.nativeElement.querySelector('.catalog-search')).toBeNull();
|
||||
page.showAllIndicators(); fixture.detectChanges(); await settle();
|
||||
expect(page.indicatorSelection()).toBeNull(); expect(ids()).toEqual(items.map(i => i.id)); http.expectNone(() => true);
|
||||
});
|
||||
it('un fijado sin seleccionar no se muestra', async () => {
|
||||
await pin('i2'); page.changeIndicatorSelection(['i0', 'i1']); fixture.detectChanges(); await settle();
|
||||
@@ -82,11 +76,16 @@ describe('UX-06E.D.3.B fijación temporal', () => {
|
||||
});
|
||||
it('memoria independiente por dominio y persistente al recrear la página', async () => {
|
||||
await pin('i3'); page.changeDominio('cacu'); load('cacu'); expect(ids()).toEqual(items.map(i => i.id));
|
||||
// CaMa has no pin control (the mockup has none), so it neither keeps nor applies pins.
|
||||
await pin('i1'); page.changeDominio('cama'); load('cama'); expect(ids()).toEqual(items.map(i => i.id));
|
||||
page.changeDominio('cacu'); load('cacu'); expect(ids()[0]).toBe('i1');
|
||||
page.changeDominio('tea'); load(); expect(ids()[0]).toBe('i3');
|
||||
fixture.destroy(); create(); load(); expect(ids()[0]).toBe('i3'); http.expectNone(() => true);
|
||||
const memory = TestBed.inject(IndicadoresMemory);
|
||||
expect(memory.isPinned('cacu', 'i1')).toBe(true);
|
||||
expect(memory.isPinned('tea', 'i3')).toBe(true);
|
||||
expect(memory.isPinned('cama', 'i1')).toBe(false);
|
||||
page.changeDominio('cacu'); load('cacu'); expect(ids()).toEqual(items.map(i => i.id));
|
||||
page.changeDominio('tea'); load(); expect(ids()).toEqual(items.map(i => i.id));
|
||||
fixture.destroy(); create(); load();
|
||||
expect(TestBed.inject(IndicadoresMemory).isPinned('tea', 'i3')).toBe(true);
|
||||
expect(ids()).toEqual(items.map(i => i.id)); http.expectNone(() => true);
|
||||
});
|
||||
it('no usa Storage y una nueva memoria reinicia la fijación', async () => {
|
||||
const read = vi.spyOn(Storage.prototype, 'getItem'), write = vi.spyOn(Storage.prototype, 'setItem');
|
||||
@@ -94,10 +93,12 @@ describe('UX-06E.D.3.B fijación temporal', () => {
|
||||
expect(new IndicadoresMemory().isPinned('tea', 'i2')).toBe(false);
|
||||
expect(read).not.toHaveBeenCalled(); expect(write).not.toHaveBeenCalled(); http.expectNone(() => true);
|
||||
});
|
||||
it('mover la tarjeta conserva foco en su botón existente', async () => {
|
||||
const control = button('i4'); control.focus(); await pin('i4');
|
||||
expect(control.isConnected).toBe(true); expect(document.activeElement).toBe(control);
|
||||
await pin('i4'); expect(document.activeElement).toBe(control); http.expectNone(() => true);
|
||||
it('fijar no mueve la tarjeta ni pide figuras', async () => {
|
||||
const before = cards();
|
||||
await pin('i4');
|
||||
expect(cards()).toEqual(before);
|
||||
await pin('i4');
|
||||
expect(cards()).toEqual(before); http.expectNone(() => true);
|
||||
});
|
||||
it('preserva figura seleccionada, estado de visibilidad, panel y host Plotly', async () => {
|
||||
card('i3').setVisible(true); fixture.detectChanges(); respond(); await settle();
|
||||
|
||||
@@ -4,7 +4,6 @@ import { provideHttpClient } from '@angular/common/http';
|
||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { provideRouter } from '@angular/router';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { IndicadoresPage } from './indicadores-page';
|
||||
import { IndicadorCatalogCard } from './indicador-catalog-card';
|
||||
import { IndicadorFigurePanel } from './indicador-figure-panel';
|
||||
@@ -40,24 +39,20 @@ describe('Selección de indicadores gráficos', () => {
|
||||
function cards() { return fixture.debugElement.queryAll(By.directive(IndicadorCatalogCard)).map(e => e.componentInstance as IndicadorCatalogCard); }
|
||||
function ids() { return cards().map(c => c.indicador.id); }
|
||||
function panels() { return fixture.debugElement.queryAll(By.directive(IndicadorFigurePanel)).map(e => e.componentInstance as IndicadorFigurePanel); }
|
||||
function select() { return fixture.debugElement.query(By.css('.catalog-search mat-select'))?.componentInstance as MatSelect | undefined; }
|
||||
function showAll(): HTMLButtonElement { return fixture.nativeElement.querySelector('.catalog-search button'); }
|
||||
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, 2, 5])('no ofrece buscador y muestra el catálogo completo: %i indicadores', count => {
|
||||
load(Array.from({ length: count }, (_, i) => ({ ...items[0], id: 'id-' + i })));
|
||||
expect(!!select()).toBe(count >= 2); expect(cards()).toHaveLength(count);
|
||||
expect(fixture.nativeElement.querySelector('.catalog-search')).toBeNull();
|
||||
expect(cards()).toHaveLength(count);
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('lista todo el catálogo, con todos seleccionados al inicio', () => {
|
||||
load();
|
||||
expect(select()!.multiple).toBe(true);
|
||||
expect(select()!.options.map(o => o._getHostElement().querySelector('.option-title')!.textContent)).toEqual(items.map(i => i.titulo));
|
||||
expect(fixture.nativeElement.querySelector('.catalog-search')).toBeNull();
|
||||
expect(page.selectedIndicators()).toEqual(items.map(i => i.id));
|
||||
expect(page.selectionSummary()).toBe('Todos los indicadores');
|
||||
expect(result()).toBe('Mostrando 5 de 5 indicadores.');
|
||||
expect(showAll().disabled).toBe(true);
|
||||
expect(fixture.nativeElement.textContent).not.toContain('Mostrando 5 de 5 indicadores.');
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('solo renderiza los seleccionados y conserva las tarjetas que siguen visibles', () => {
|
||||
@@ -66,7 +61,6 @@ describe('Selección de indicadores gráficos', () => {
|
||||
expect(ids()).toEqual(['B02', 'E05']);
|
||||
expect(cards()[0]).toBe(before[1]); expect(cards()[1]).toBe(before[4]);
|
||||
expect(page.selectionSummary()).toBe('2 indicadores');
|
||||
expect(result()).toBe('Mostrando 2 de 5 indicadores.');
|
||||
expect(fixture.nativeElement.textContent).not.toContain('indicadores publicados');
|
||||
choose(['M02_sexo']); expect(ids()).toEqual(['M02_sexo']); expect(page.selectionSummary()).toBe('Distribución por sexo');
|
||||
expect(page.catalog()).toBe(original);
|
||||
@@ -76,9 +70,8 @@ describe('Selección de indicadores gráficos', () => {
|
||||
load(); choose([]);
|
||||
expect(cards()).toHaveLength(0); expect(panels()).toHaveLength(0);
|
||||
expect(fixture.nativeElement.textContent).toContain('No hay indicadores seleccionados');
|
||||
expect(showAll().disabled).toBe(false);
|
||||
showAll().click(); fixture.detectChanges();
|
||||
expect(ids()).toEqual(items.map(i => i.id)); expect(page.indicatorSelection()).toBeNull(); expect(showAll().disabled).toBe(true);
|
||||
page.showAllIndicators(); fixture.detectChanges();
|
||||
expect(ids()).toEqual(items.map(i => i.id)); expect(page.indicatorSelection()).toBeNull();
|
||||
http.expectNone(() => true);
|
||||
});
|
||||
it('marcar todos equivale a no filtrar', () => {
|
||||
@@ -90,26 +83,18 @@ describe('Selección de indicadores gráficos', () => {
|
||||
choose(['A01']);
|
||||
expect(Array.from(fixture.nativeElement.querySelectorAll('app-indicador-kpi-panel'))).toEqual(kpis);
|
||||
});
|
||||
it('«Ir» lleva a la tarjeta sin alternar la opción y muestra el indicador si estaba oculto', async () => {
|
||||
it('ir a un indicador oculto lo vuelve a mostrar y desplaza hasta su tarjeta', async () => {
|
||||
const scroll = vi.fn();
|
||||
Element.prototype.scrollIntoView = scroll;
|
||||
load(); choose(['A01']);
|
||||
select()!.open(); fixture.detectChanges(); await fixture.whenStable();
|
||||
const go = (id: string) => Array.from(document.querySelectorAll<HTMLAnchorElement>('.indicator-select-panel .option-go'))
|
||||
.find(a => a.closest('mat-option')!.textContent!.includes(items.find(i => i.id === id)!.titulo))!;
|
||||
expect(go('D04').getAttribute('aria-label')).toBe('Ir a Seguimiento');
|
||||
// The scroll waits until the panel has finished closing.
|
||||
const settle = (calls: number) => vi.waitFor(async () => { fixture.detectChanges(); await fixture.whenStable(); expect(scroll).toHaveBeenCalledTimes(calls); });
|
||||
go('D04').click(); fixture.detectChanges(); await fixture.whenStable();
|
||||
expect(document.querySelector('.indicator-select-panel')).toBeNull();
|
||||
page.goToIndicator('D04'); fixture.detectChanges(); await fixture.whenStable();
|
||||
expect(page.selectedIndicators()).toEqual(['A01', 'D04']);
|
||||
expect(select()!.panelOpen).toBe(false);
|
||||
await settle(1);
|
||||
await vi.waitFor(async () => { fixture.detectChanges(); await fixture.whenStable(); expect(scroll).toHaveBeenCalledTimes(1); });
|
||||
expect((scroll.mock.contexts[0] as HTMLElement).querySelector('h2')?.textContent).toContain('Seguimiento');
|
||||
select()!.open(); fixture.detectChanges(); await fixture.whenStable();
|
||||
go('A01').click(); fixture.detectChanges(); await fixture.whenStable();
|
||||
// Already visible: the selection is untouched.
|
||||
page.goToIndicator('A01'); fixture.detectChanges(); await fixture.whenStable();
|
||||
expect(page.selectedIndicators()).toEqual(['A01', 'D04']);
|
||||
await settle(2);
|
||||
await vi.waitFor(async () => { fixture.detectChanges(); await fixture.whenStable(); expect(scroll).toHaveBeenCalledTimes(2); });
|
||||
http.match(() => true).forEach(r => r.flush({ data: [], layout: {} }));
|
||||
});
|
||||
it('no muestra el botón flotante de navegación por indicadores', () => {
|
||||
|
||||
@@ -186,11 +186,11 @@ describe('UX-06E.D.3.A tarjetas permanentes y visibilidad controlada', () => {
|
||||
const target = before[0].visibilityRegion!.nativeElement; notify(); page.togglePinned(items[4]); await render();
|
||||
page.changeIndicatorSelection([items[3].id, items[4].id]); await render(); positions(cards().map((_, i) => [1200 + i * 1000, 0]));
|
||||
observer().emit(target); await idle(); http.expectNone(() => true);
|
||||
// The pinned indicator leads; the other selected one keeps its component.
|
||||
expect(cards()).toEqual([before[4], before[3]]);
|
||||
positions(cards().map((_, i) => [i === 1 ? 200 : 1200 + i * 1000, 0])); notify(); await confirm();
|
||||
// Pins no longer reorder; the selected indicators keep catalog order and their components.
|
||||
expect(cards()).toEqual([before[3], before[4]]);
|
||||
positions(cards().map((_, i) => [i === 0 ? 200 : 1200 + i * 1000, 0])); notify(); await confirm();
|
||||
http.expectOne(r => r.url.includes('/i3/figuras/')).flush({ data: [], layout: {} }); await render();
|
||||
expect(cards()[1].selectedFigure).toBe('f');
|
||||
expect(cards()[0].selectedFigure).toBe('f');
|
||||
});
|
||||
it.each([{ data: [], layout: {} }, { data: [{ y: [null, null] }], layout: { annotations: [{ text: 'Valores ocultos por supresión.' }] } }])('resultado vacío o suprimido termina skeleton y conserva JSON: %j', async figure => {
|
||||
await load([items[0]]); positions([[200, 0]]); notify(); await confirm();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<section class="dashboard">
|
||||
<header><span class="domain">Trastorno del espectro autista, investigación</span><h1>Indicadores</h1><p>Explore la información del tamizaje.</p></header>
|
||||
<nav class="domain-nav" aria-label="Dominios de indicadores"><a routerLink="/indicadores/cacu">Cáncer cervicouterino</a><a routerLink="/indicadores/cama">Cáncer de mama</a><a routerLink="/indicadores/tea" aria-current="page">TEA</a></nav>
|
||||
<nav class="tabs" aria-label="Secciones de TEA">
|
||||
<header><h1>Trastorno del espectro autista</h1><p>Explora los indicadores de trastorno del espectro autista.</p></header>
|
||||
<nav class="domain-nav" aria-label="Dominios de indicadores"><a routerLink="/indicadores/cacu">Cáncer cervicouterino</a><a routerLink="/indicadores/cama">Cáncer de mama</a><a routerLink="/indicadores/tea" aria-current="page">Trastorno del espectro autista</a></nav>
|
||||
<nav class="tabs" aria-label="Secciones de trastorno del espectro autista">
|
||||
<button type="button" [attr.aria-current]="section() === 'resumen' ? 'page' : null" (click)="changeSection('resumen')">Resumen</button>
|
||||
<button type="button" [attr.aria-current]="section() === 'historico' ? 'page' : null" (click)="changeSection('historico')">Histórico</button>
|
||||
<button type="button" [attr.aria-current]="section() === 'seguimiento' ? 'page' : null" (click)="changeSection('seguimiento')">Seguimiento</button>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.dashboard { max-width: 1200px; margin: 0 auto; padding: 1.5rem; color: #142b3d; }
|
||||
.domain { color: #24735a; font-weight: 600; }
|
||||
.domain-nav, .tabs, form, .paging { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin: 1rem 0; }
|
||||
.domain-nav a { color: #216b56; padding: .5rem; }
|
||||
.tabs { border-bottom: 1px solid #c9d6d1; }
|
||||
|
||||
Reference in New Issue
Block a user