+
`,
styles: `
- :host { display: block; min-width: 0; }
- section { margin-top: var(--issste-space-6); padding-top: var(--issste-space-4); border-top: 1px solid var(--issste-border); }
- .applied-summary { color: var(--issste-text-secondary); overflow-wrap: anywhere; }
+ :host { display: grid; min-width: 0; }
+ .figure-panel { display: grid; min-width: 0; grid-template-rows: auto minmax(0, 1fr) auto; }
+ .panel-controls { min-width: 0; padding-block: var(--issste-space-3); border-top: 1px solid var(--issste-border); }
+ .applied-summary { margin: 0; color: var(--issste-text-secondary); overflow-wrap: anywhere; }
+ .selection-status { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap;
+ font: var(--mat-sys-body-small); color: var(--issste-text-secondary); cursor: help; }
+ .selection-active { color: var(--issste-text); font-weight: 600; }
+ .selection-status:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
+ .stratified-detail { min-width: 0; overflow-wrap: anywhere; }
+ @supports (grid-template-rows: subgrid) {
+ :host, .figure-panel { grid-template-rows: subgrid; }
+ .figure-panel { grid-row: span 8; }
+ .panel-controls { grid-row: 1; }
+ app-indicador-figure-card { grid-row: 2 / span 6; }
+ .stratified-detail { grid-row: 8; }
+ }
+ :host:has(app-indicador-figure-card.methodology-expanded),
+ .figure-panel:has(app-indicador-figure-card.methodology-expanded) { grid-template-rows: auto auto auto; }
+ .figure-panel:has(app-indicador-figure-card.methodology-expanded) { grid-row: auto; }
.distribution-control { margin: var(--issste-space-3) 0; padding: 0; border: 0; min-width: 0; }
.distribution-control legend { padding: 0; font-weight: 600; }
.distribution-toggle, .distribution-dimensions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
diff --git a/src/app/features/indicadores/indicadores-c2-general-panel.spec.ts b/src/app/features/indicadores/indicadores-c2-general-panel.spec.ts
index d6f3ac6..ca462e9 100644
--- a/src/app/features/indicadores/indicadores-c2-general-panel.spec.ts
+++ b/src/app/features/indicadores/indicadores-c2-general-panel.spec.ts
@@ -37,10 +37,39 @@ describe('barras generales conectadas con la selección compartida de la dona',
select({ parent: 'G2', period: '2025-S2' }); expect(displayed().data[0]['y']).toEqual(['B', 'C']);
select({ parent: 'G2', category: 'B', period: '2025-S2' }); expect(displayed().data[0]['y']).toEqual(['B']);
expect(panel().result().figure).toBe(original); expect(original).toEqual(before);
- expect(fixture.nativeElement.textContent).toContain('G2 · B · 2025-S2');
+ expect(fixture.nativeElement.querySelector('.selection-status').getAttribute('aria-label')).toContain('G2 · B · 2025-S2');
select({}); expect(displayed()).toEqual(all); expect(panel().generalSelectionContext).toBeUndefined();
expect(panel().applied).toEqual(filter); expect(fixture.nativeElement.querySelector('app-plotly-chart')).toBe(host); http.expectNone(() => true);
});
+ it('mantiene el mismo estado compacto antes, durante y después de seleccionar, fuera del lienzo', () => {
+ load();
+ const status = fixture.nativeElement.querySelector('.selection-status') as HTMLElement;
+ const plot = fixture.nativeElement.querySelector('app-plotly-chart') as HTMLElement;
+ const height = plot.style.getPropertyValue('--plot-height');
+ expect(status.textContent).toContain('Distribución completa');
+ expect(status.closest('.panel-controls')).toBeTruthy();
+ select({ parent: 'G2', period: '2025-S2' });
+ expect(fixture.nativeElement.querySelector('.selection-status')).toBe(status);
+ expect(status.textContent).toContain('Selección activa');
+ expect(status.getAttribute('aria-label')).toContain('denominador de la distribución completa');
+ expect(fixture.nativeElement.querySelectorAll('.distribution-note')).toHaveLength(0);
+ expect(plot.style.getPropertyValue('--plot-height')).toBe(height);
+ select({});
+ expect(status.textContent).toContain('Distribución completa');
+ expect(fixture.nativeElement.querySelector('app-plotly-chart')).toBe(plot);
+ http.expectNone(() => true);
+ });
+ it('el estado compacto general no describe una distribución estratificada ni oculta su error', () => {
+ fixture.componentRef.setInput('indicador', { ...item, filtros: [
+ { estrato: 'grupo_edad', etiqueta: 'Edad', valores: [{ valor: 'adulto', etiqueta: 'Adulto' }] },
+ ] });
+ load(); select({ parent: 'G2', period: '2025-S2' });
+ panel().chooseStratified(); request().flush({}, { status: 500, statusText: 'Failure' }); fixture.detectChanges();
+ expect(fixture.nativeElement.querySelector('.selection-status')).toBeNull();
+ expect(fixture.nativeElement.querySelector('[role="alert"]')).toBeTruthy();
+ expect(panel().result().status).toBe('error');
+ http.expectNone(() => true);
+ });
it('una selección recibida mientras carga se aplica al terminar sin otro GET', () => {
fixture.detectChanges(); const pending = request(); select({ parent: 'G2', period: '2025-S2' });
pending.flush(c2Fixture()); fixture.detectChanges(); expect(displayed().data[0]['y']).toEqual(['B', 'C']); http.expectNone(() => true);
diff --git a/src/app/features/indicadores/indicadores-navigation.spec.ts b/src/app/features/indicadores/indicadores-navigation.spec.ts
index c2cb052..60a662a 100644
--- a/src/app/features/indicadores/indicadores-navigation.spec.ts
+++ b/src/app/features/indicadores/indicadores-navigation.spec.ts
@@ -44,28 +44,7 @@ describe('UX-04 navegación Angular', () => {
const harness = await setup();
await harness.navigateByUrl('/indicadores/' + domain, IndicadoresPage);
load(domain, harness); harness.detectChanges();
- const links = Array.from(harness.routeNativeElement!.querySelectorAll('nav a')) as HTMLAnchorElement[];
- expect(links.map(a => a.textContent?.trim())).toEqual(['TEA', 'CaCu', 'CaMa']);
- expect(links.map(a => a.getAttribute('href'))).toEqual(['/indicadores/tea', '/indicadores/cacu', '/indicadores/cama']);
- const selected = links.find(a => a.getAttribute('aria-current') === 'page')!;
- expect(selected.getAttribute('href')).toBe('/indicadores/' + domain);
- expect(links.filter(a => a.hasAttribute('aria-current'))).toHaveLength(1);
- // Check the compiled CSSOM rule against the actual encapsulated element.
- // jsdom's computed link decoration can remain stale after aria-current changes.
- const activeRule = Array.from(document.styleSheets).flatMap(sheet => Array.from(sheet.cssRules))
- .find((rule): rule is CSSStyleRule => rule instanceof CSSStyleRule
- && rule.selectorText.includes('[aria-current=') && selected.matches(rule.selectorText))!;
- expect(activeRule).toBeTruthy();
- expect(activeRule.style.getPropertyValue('text-decoration')).toBe('none');
- expect(activeRule.style.getPropertyValue('font-weight')).toBe('700');
- expect(activeRule.style.getPropertyValue('background')).toBe('var(--issste-accent)');
- for (const link of links) {
- expect(link.tabIndex).toBe(0);
- link.focus(); expect(document.activeElement).toBe(link);
- const key = new KeyboardEvent('keydown', { key: 'Enter', bubbles: true, cancelable: true });
- link.dispatchEvent(key); expect(key.defaultPrevented).toBe(false);
- expect(selected.getAttribute('aria-current')).toBe('page');
- }
+ expect(harness.routeNativeElement!.querySelector('nav')).toBeNull();
http.expectNone(() => true);
});
it('mantiene la ruta, restaura borradores y reconsulta la aplicación entre TEA/CaCu/CaMa', async () => {
diff --git a/src/app/features/indicadores/indicadores-page.html b/src/app/features/indicadores/indicadores-page.html
index db3cb6b..33124c2 100644
--- a/src/app/features/indicadores/indicadores-page.html
+++ b/src/app/features/indicadores/indicadores-page.html
@@ -4,12 +4,6 @@
Dashboard de indicadores
Explora las figuras de indicadores {{ domainLabels[dominio] }} generadas por el servicio de reportes.
-
- @for (domain of dominios; track domain) {
- {{ domainLabels[domain] }}
- }
-
-
@for (section of sections; track section.id) {
app-indicador-catalog-card { min-width: 0; margin: 0; }
.catalog-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--issste-space-3); margin-bottom: var(--issste-space-4); }
.catalog-count { margin: 0 0 0 auto; text-align: right; color: var(--issste-text-secondary); overflow-wrap: anywhere; }
@@ -24,32 +24,8 @@ header p { color: var(--mat-sys-on-surface-variant); margin-bottom: 1.5rem; }
@container dashboard (min-width: 600px) { .kpi-grid { grid-template-columns: repeat(min(2, var(--kpi-count)), minmax(0, 1fr)); } }
@container dashboard (min-width: 1304px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
-nav {
- display: flex;
- flex-wrap: wrap;
- gap: var(--issste-space-2);
- padding: var(--issste-space-2);
- justify-content: center;
- margin: var(--issste-space-4) 0;
- border-radius: var(--issste-radius);
-}
-nav a {
- flex: 0 1 6rem;
- max-width: 10rem;
- color: var(--issste-text);
- border: 1px solid var(--issste-border);
- background: var(--issste-surface);
- min-height: 44px;
- border-radius: var(--issste-radius);
-}
-nav a[aria-current='page'] {
- background: var(--issste-accent);
- font-weight: 700;
- text-decoration: none;
-}
@media (max-width: 550px) {
h1 { font-size: var(--mat-sys-headline-medium-size); line-height: var(--mat-sys-headline-medium-line-height); }
- nav { gap: var(--issste-space-2); padding-inline: 0; }
}
.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; }
diff --git a/src/app/features/indicadores/indicadores-page.spec.ts b/src/app/features/indicadores/indicadores-page.spec.ts
index 31dfc1f..3331484 100644
--- a/src/app/features/indicadores/indicadores-page.spec.ts
+++ b/src/app/features/indicadores/indicadores-page.spec.ts
@@ -112,22 +112,15 @@ describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => {
expect(fixture.nativeElement.querySelector('.pin-toggle').getAttribute('aria-label')).toContain(title);
http.expectNone(() => true);
});
- it('UX-06B conserva una navegación con rutas y estado activo en los tres dominios', () => {
- const domains = ['tea', 'cacu', 'cama'] as const;
- for (const domain of domains) {
- if (domain !== 'tea') page.changeDominio(domain);
- load([], domain);
- const navs = fixture.nativeElement.querySelectorAll('nav') as NodeListOf;
- expect(navs).toHaveLength(1);
- expect(navs[0].getAttribute('aria-label')).toBe('Dominios de indicadores');
- const links = Array.from(navs[0].querySelectorAll('a'));
- expect(links.map(link => link.textContent?.trim())).toEqual(['TEA', 'CaCu', 'CaMa']);
- expect(links.map(link => link.getAttribute('href'))).toEqual(domains.map(d => '/indicadores/' + d));
- expect(links.filter(link => link.getAttribute('aria-current') === 'page')).toHaveLength(1);
- expect(links[domains.indexOf(domain)].getAttribute('aria-current')).toBe('page');
- expect(cards()).toHaveLength(0);
- http.expectNone(() => true);
- }
+ it('UX-06B deja la navegación entre dominios en el shell y no duplica botones en la página', () => {
+ expect(fixture.nativeElement.querySelector('nav')).toBeNull();
+ expect(fixture.nativeElement.querySelectorAll('[routerLink]')).toHaveLength(0);
+ expect(cards()).toHaveLength(0);
+ // Constructing the page legitimately initializes its domain catalog.
+ const catalogRequest = http.expectOne('/tea/indicadores');
+ expect(catalogRequest.request.method).toBe('GET');
+ catalogRequest.flush([]);
+ http.expectNone(() => true);
});
it('UX-06D retira el selector visual, inicia claro y conserva oscuro sin recargar catálogo', async () => {
diff --git a/src/app/features/indicadores/indicadores-page.ts b/src/app/features/indicadores/indicadores-page.ts
index dd302d2..6844565 100644
--- a/src/app/features/indicadores/indicadores-page.ts
+++ b/src/app/features/indicadores/indicadores-page.ts
@@ -1,7 +1,7 @@
import { DOCUMENT } from '@angular/common';
import { afterEveryRender, afterNextRender, ChangeDetectorRef, Component, DestroyRef, ElementRef, Injector, inject, computed, signal, viewChild, viewChildren } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
-import { ActivatedRoute, RouterLink } from '@angular/router';
+import { ActivatedRoute } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
@@ -30,7 +30,7 @@ type DashboardSection = 'resumen' | 'seguimiento' | 'datos';
@Component({
selector: 'app-indicadores-page',
- imports: [RouterLink, FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard, IndicadorKpiPanel, IndicadorPeriodFilters, IndicadoresDefinitions, IndicadoresTracking, IndicadoresNumericSummary],
+ imports: [FormsModule, MatButtonModule, MatCardModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressBarModule, IndicadorCatalogCard, IndicadorKpiPanel, IndicadorPeriodFilters, IndicadoresDefinitions, IndicadoresTracking, IndicadoresNumericSummary],
templateUrl: './indicadores-page.html',
styleUrl: './indicadores-page.scss',
})
diff --git a/src/app/features/indicadores/indicadores-sections.spec.ts b/src/app/features/indicadores/indicadores-sections.spec.ts
index 4587f02..ec88c2c 100644
--- a/src/app/features/indicadores/indicadores-sections.spec.ts
+++ b/src/app/features/indicadores/indicadores-sections.spec.ts
@@ -40,7 +40,8 @@ describe('Secciones compartidas por dominio', () => {
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(root.querySelector('[role="tablist"]')?.getAttribute('aria-label')).toContain(page.domainLabels[domain]);
- expect(root.querySelector('a[aria-current="page"]')?.textContent?.trim()).toBe(page.domainLabels[domain]);
+ // Domain selection belongs to App; this route-only harness verifies page sections.
+ expect(root.querySelector('nav')).toBeNull();
for (const tab of tabs) {
const panel = root.querySelector('#' + tab.getAttribute('aria-controls'))!;
expect(panel.getAttribute('aria-labelledby')).toBe(tab.id);