feat(ui): incorporar filtros globales por dominio UX-06E.D.2

This commit is contained in:
Angel Capetillo Zavala
2026-10-13 19:45:48 -06:00
parent 98d0614d80
commit c4faa7d9f6
20 changed files with 467 additions and 218 deletions
@@ -253,8 +253,8 @@ describe('UX-06E.D.1.1 visibilidad controlada', () => {
filters.changeMode('manual'); filters.year = '2025'; filters.unit = 'S1'; filters.add();
cards()[0].toggle(); await render(); expect(requests[2].cancelled).toBe(true);
notify(); await idle(); http.expectNone(() => true); cards()[0].toggle(); await render();
expect(panels()[0].filters?.editors.semestre?.draft).toEqual({ mode: 'explicit', periodos: ['2025-S1'] });
expect(panels()[0].filters?.applied?.selection.mode).toBe('todos'); respond();
expect(page.filters?.editors.semestre?.draft).toEqual({ mode: 'explicit', periodos: ['2025-S1'] });
expect(page.filters?.applied?.selection.mode).toBe('todos'); respond();
});
it('fallback sin observers permite la apertura y cierre de una tarjeta pendiente', async () => {
http.expectOne('/tea/indicadores'); fixture.destroy(); vi.stubGlobal('IntersectionObserver', undefined); vi.stubGlobal('ResizeObserver', undefined); create();
@@ -307,4 +307,25 @@ describe('UX-06E.D.1.1 visibilidad controlada', () => {
expect(panels()[0]).toBe(panel); expect(panel.result()).toBe(result); expect(document.activeElement).toBe(input);
expect(runtime.react).toHaveBeenCalledTimes(reacts); expect(runtime.purge).not.toHaveBeenCalled(); http.expectNone(() => true);
});
it('D.2 aplicar fuera de pantalla no activa tarjetas y scroll consulta la revisión vigente una sola vez', async () => {
await load(); await idle();
const filters = fixture.debugElement.query(By.directive(IndicadorPeriodFilters)).componentInstance as IndicadorPeriodFilters;
filters.changeMode('manual'); filters.year = '2025'; filters.unit = 'S1'; filters.add();
page.applyFilters(); await render(); await idle();
expect(cards().every(card => !card.figuresActivated)).toBe(true); http.expectNone(() => true);
positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]);
window.dispatchEvent(new Event('scroll')); await confirm();
const first = http.expectOne(r => r.url.includes('/i0/figuras/'));
expect(first.request.params.get('periodos')).toBe('2025-S1'); first.flush({ data: [], layout: {} });
expect(panels()[0].applied.revision).toBe(1); await idle();
cards()[0].toggle(); await render();
filters.unit = 'S2'; filters.add(); page.applyFilters(); await render(); await idle();
expect(memory.activation('tea', 'i0')).toBe('manual-closed'); http.expectNone(() => true);
positions([[-1000, 0], [200, 0], [1200, 0], [1400, 0], [1600, 0]]);
window.dispatchEvent(new Event('scroll')); await confirm();
const second = http.expectOne(r => r.url.includes('/i1/figuras/'));
expect(second.request.params.get('periodos')).toBe('2025-S1,2025-S2'); second.flush({ data: [], layout: {} });
expect(panels()[0].applied.revision).toBe(2); await idle();
notify(1); await idle(); page.applyFilters(); await render(); http.expectNone(() => true);
});
});