feat(ui): redisenar catalogo y filtros UX-06C

This commit is contained in:
Angel Capetillo Zavala
2026-10-13 12:34:03 -06:00
parent ecf2778f1a
commit 41be0c343f
11 changed files with 195 additions and 33 deletions
@@ -41,6 +41,56 @@ describe('UX-05B catálogo expandible', () => {
function flushAll() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [0, null] }], layout: {} })); fixture.detectChanges(); }
function control(index = 0) { return fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))[index].componentInstance as IndicadorPeriodFilters; }
it('UX-06C: tarjeta contraída contiene solo identidad y flecha decorativa en un botón nativo', () => {
load();
const host = fixture.nativeElement.querySelector('app-indicador-catalog-card') as HTMLElement;
const header = host.querySelector('header')!;
expect(header.querySelector('h2')?.textContent).toBe('Uno');
expect(header.querySelector('.indicator-id')?.textContent).toBe('i1');
expect(host.textContent).not.toContain('Contrato');
expect(host.textContent).not.toContain('figuras publicadas');
expect(host.querySelectorAll('app-indicador-figure-panel')).toHaveLength(0);
const button = header.querySelector('button')!;
expect(button.type).toBe('button');
expect(button.tabIndex).toBe(0);
expect(button.getAttribute('aria-expanded')).toBe('false');
expect(button.getAttribute('aria-label')).toContain('Expandir tea · i1 · Uno');
expect(button.querySelector('mat-icon')?.textContent?.trim()).toBe('expand_more');
expect(button.querySelector('mat-icon')?.getAttribute('aria-hidden')).toBe('true');
http.expectNone(() => true);
});
it('UX-06C: conserva encabezado, botón y relación accesible al abrir varias figuras y contraer', () => {
load();
const host = fixture.nativeElement.querySelector('app-indicador-catalog-card') as HTMLElement;
const header = host.querySelector('header')!;
const button = header.querySelector('button')!;
const contentId = button.getAttribute('aria-controls')!;
button.click(); fixture.detectChanges(); flushAll();
expect(host.querySelector('header')).toBe(header);
expect(header.querySelector('button')).toBe(button);
expect(button.getAttribute('aria-controls')).toBe(contentId);
expect(button.getAttribute('aria-expanded')).toBe('true');
expect(button.querySelector('mat-icon')?.textContent?.trim()).toBe('expand_less');
expect(button.getAttribute('aria-label')).toContain('Contraer tea · i1 · Uno');
expect(header.textContent).not.toContain('Contrato');
expect(host.querySelector('.catalog-metadata')?.textContent).toContain('Contrato C1 · 2 figuras publicadas');
expect(host.querySelectorAll('app-indicador-figure-panel')).toHaveLength(2);
button.click(); fixture.detectChanges();
expect(host.querySelector('.catalog-metadata')).toBeNull();
expect(host.querySelectorAll('app-indicador-figure-panel')).toHaveLength(0);
expect(button.querySelector('mat-icon')?.textContent?.trim()).toBe('expand_more');
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';
load([{ ...item, titulo: title }, second]);
const header = fixture.nativeElement.querySelector('app-indicador-catalog-card header') as HTMLElement;
expect(header.querySelector('h2')?.textContent).toBe(title);
expect(header.querySelector('.card-identity button')).toBeNull();
expect(header.lastElementChild?.tagName).toBe('BUTTON');
expect(header.querySelector('button')?.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) {