import { Component } from '@angular/core'; import { TestBed } from '@angular/core/testing'; 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 { IndicadoresPage } from './indicadores-page'; import { IndicadorCatalogCard } from './indicador-catalog-card'; import { IndicadorFigureCard } from './indicador-figure-card'; import { IndicadorFigurePanel } from './indicador-figure-panel'; import { IndicadorPeriodFilters } from './indicador-period-filters'; import { IndicadoresMemory } from './indicadores-memory'; import { Indicador } from './indicadores.models'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; import { PLOTLY_LOADER } from '../../shared/plotly/plotly-runtime'; @Component({ selector: 'app-plotly-chart', inputs: ['figure', 'label'], template: '' }) class ChartStub {} const items: Indicador[] = Array.from({ length: 5 }, (_, i) => ({ id: 'i' + i, titulo: 'Indicador ' + i, contrato: 'C1', figuras: ['f'], tipos_periodo: ['semestre', 'mes'], })); // jsdom geometry and browser notifications are explicit, independent inputs. class IntersectionControl { static instances: IntersectionControl[] = []; readonly targets = new Set(); observe = vi.fn((target: Element) => this.targets.add(target)); unobserve = vi.fn((target: Element) => this.targets.delete(target)); disconnect = vi.fn(() => this.targets.clear()); constructor(readonly callback: IntersectionObserverCallback, readonly options: IntersectionObserverInit) { IntersectionControl.instances.push(this); } emit(target: Element, isIntersecting = true) { this.callback([{ target, isIntersecting, intersectionRatio: isIntersecting ? 1 : 0 } as IntersectionObserverEntry], this as unknown as IntersectionObserver); } } class ResizeControl { static instances: ResizeControl[] = []; readonly targets = new Set(); observe = vi.fn((target: Element) => this.targets.add(target)); unobserve = vi.fn((target: Element) => this.targets.delete(target)); disconnect = vi.fn(() => this.targets.clear()); constructor(readonly callback: ResizeObserverCallback) { ResizeControl.instances.push(this); } emit() { this.callback([], this as unknown as ResizeObserver); } } describe('UX-06E.D.1.1 visibilidad controlada', () => { let fixture: ReturnType>; let page: IndicadoresPage; let http: HttpTestingController; let memory: IndicadoresMemory; let sticky: HTMLElement; let geometry: WeakMap; let frames: Map; let sequence: number; const runtime = { react: vi.fn(), purge: vi.fn(), Plots: { resize: vi.fn() } }; function rect(top: number, left = 0, width = 600, height = 80): DOMRect { return { x: left, y: top, top, left, width, height, right: left + width, bottom: top + height, toJSON: () => ({}) } as DOMRect; } beforeEach(() => { IntersectionControl.instances = []; ResizeControl.instances = []; geometry = new WeakMap(); frames = new Map(); sequence = 0; vi.stubGlobal('IntersectionObserver', IntersectionControl); vi.stubGlobal('ResizeObserver', ResizeControl); vi.stubGlobal('innerWidth', 1440); vi.stubGlobal('innerHeight', 800); vi.spyOn(window, 'requestAnimationFrame').mockImplementation(callback => { frames.set(++sequence, callback); return sequence; }); vi.spyOn(window, 'cancelAnimationFrame').mockImplementation(id => { frames.delete(id); }); vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function(this: Element) { return geometry.get(this) ?? rect(0, 0, 0, 0); }); sticky = document.createElement('header'); sticky.className = 'institutional-header'; document.body.append(sticky); geometry.set(sticky, rect(0, 0, 1440, 100)); runtime.react.mockReset().mockResolvedValue(undefined); runtime.purge.mockReset(); runtime.Plots.resize.mockReset().mockResolvedValue(undefined); TestBed.configureTestingModule({ imports: [IndicadoresPage], providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: PLOTLY_LOADER, useValue: () => Promise.resolve(runtime) }] }); TestBed.overrideComponent(IndicadorFigureCard, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } }); create(); }); function create() { fixture = TestBed.createComponent(IndicadoresPage); page = fixture.componentInstance; http = TestBed.inject(HttpTestingController); memory = TestBed.inject(IndicadoresMemory); } afterEach(() => { fixture.destroy(); sticky.remove(); http.verify(); vi.restoreAllMocks(); vi.unstubAllGlobals(); }); function cards() { return fixture.debugElement.queryAll(By.directive(IndicadorCatalogCard)).map(e => e.componentInstance as IndicadorCatalogCard); } function panels() { return fixture.debugElement.queryAll(By.directive(IndicadorFigurePanel)).map(e => e.componentInstance as IndicadorFigurePanel); } async function render() { fixture.detectChanges(); await fixture.whenStable(); } async function load(catalog = items, domain = 'tea') { http.expectOne('/' + domain + '/indicadores').flush(catalog); await render(); positions(cards().map((_, i) => [1000 + i * 200, 0])); } function positions(values: number[][]) { cards().forEach((card, i) => { geometry.set(card.host.nativeElement, rect(values[i][0], values[i][1])); geometry.set(card.visibilityHeader.nativeElement, rect(values[i][0] + 16, values[i][1])); }); } function observer() { return IntersectionControl.instances.at(-1)!; } async function frame() { const callbacks = [...frames.values()]; frames.clear(); callbacks.forEach(callback => callback(0)); await render(); } async function confirm() { await frame(); await frame(); } function notify(index = 0, intersects = true) { observer().emit(cards()[index].visibilityHeader.nativeElement, intersects); } function respond() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [1] }], layout: {} })); } async function idle() { for (let i = 0; i < 6 && frames.size; i++) await frame(); expect(frames.size).toBe(0); } it('observa sólo cabeceras gráficas con viewport, umbral y margen sticky medido', async () => { await load(); expect(observer().options).toEqual({ root: null, threshold: 0.25, rootMargin: '-100px 0px 0px 0px' }); expect([...observer().targets]).toEqual(cards().map(card => card.visibilityHeader.nativeElement)); expect([...observer().targets].every(target => target.tagName === 'HEADER')).toBe(true); expect(fixture.nativeElement.querySelectorAll('app-indicador-kpi-card')).toHaveLength(2); await idle(); http.expectNone(() => true); }); it('exige dos frames y activa una sola vez sin autocierre ni nuevas consultas', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await frame(); expect(cards()[0].expanded).toBe(false); http.expectNone(() => true); await frame(); expect(memory.activation('tea', 'i0')).toBe('auto-open'); expect(panels()).toHaveLength(1); respond(); const panel = panels()[0], result = panel.result(); positions([[1000, 0], [1200, 0], [1400, 0], [1600, 0], [1800, 0]]); observer().emit(cards()[0].visibilityHeader.nativeElement, false); await idle(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await idle(); expect(cards()[0].expanded).toBe(true); expect(panels()[0]).toBe(panel); expect(panel.result()).toBe(result); http.expectNone(() => true); }); it('abre juntas dos tarjetas de la fila real sin abrir filas inferiores', async () => { await load(); positions([[200, 0], [200.5, 650], [1000, 0], [1000, 650], [1200, 0]]); notify(); await confirm(); expect(cards().map(card => card.expanded)).toEqual([true, true, false, false, false]); expect(panels()).toHaveLength(2); respond(); await idle(); http.expectNone(() => true); }); it('en una columna no asocia dos indicadores por índice', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await confirm(); expect(cards().map(card => card.expanded)).toEqual([true, false, false, false, false]); respond(); await idle(); }); it('una intersección fugaz y una entrada antigua no abren una tarjeta ya fuera', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await frame(); positions([[900, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); await frame(); notify(); await idle(); expect(cards().every(card => !card.expanded)).toBe(true); http.expectNone(() => true); }); it('un desplazamiento rápido invalida la confirmación geométrica previa', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await frame(); positions([[400, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); await frame(); expect(cards()[0].expanded).toBe(false); http.expectNone(() => true); positions([[1000, 0], [1200, 0], [1400, 0], [1600, 0], [1800, 0]]); await idle(); }); it('procesa primero la fila superior y descarta inferiores desplazadas por reflow', async () => { await load(); positions([[200, 0], [200, 650], [400, 0], [400, 650], [1000, 0]]); notify(2); await confirm(); expect(cards().map(card => card.expanded)).toEqual([true, true, false, false, false]); respond(); positions([[200, 0], [200, 650], [1100, 0], [1100, 650], [1300, 0]]); await idle(); expect(cards()[2].expanded).toBe(false); http.expectNone(() => true); }); it('las filas todavía visibles se activan en nuevas evaluaciones después de render', async () => { await load(); positions([[200, 0], [200, 650], [450, 0], [450, 650], [1000, 0]]); notify(); await confirm(); respond(); await confirm(); expect(cards().map(card => card.expanded)).toEqual([true, true, true, true, false]); respond(); await idle(); }); it('recalcula asociaciones responsive entre los dos frames', async () => { await load(); positions([[200, 0], [200, 650], [1000, 0], [1000, 650], [1200, 0]]); notify(); await frame(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); window.dispatchEvent(new Event('resize')); await frame(); expect(cards().every(card => !card.expanded)).toBe(true); await frame(); expect(cards().map(card => card.expanded)).toEqual([true, false, false, false, false]); respond(); await idle(); }); it('excluye cabeceras detrás de sticky y mide sus cambios de altura', async () => { await load(); positions([[0, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await idle(); http.expectNone(() => true); const old = observer(); geometry.set(sticky, rect(0, 0, 1440, 50)); ResizeControl.instances.find(instance => instance.targets.has(sticky))!.emit(); await frame(); expect(old.disconnect).toHaveBeenCalled(); expect(observer().options.rootMargin).toBe('-50px 0px 0px 0px'); await frame(); expect(cards()[0].expanded).toBe(true); respond(); await idle(); }); it('una cabecera parcialmente visible por debajo del umbral no se activa', async () => { await load(); positions([[770, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await idle(); expect(cards()[0].expanded).toBe(false); http.expectNone(() => true); }); it('cierre manual prevalece sobre una confirmación pendiente y permite reapertura', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await frame(); cards()[0].toggle(); await render(); const request = http.expectOne(r => r.url.includes('/figuras/')); cards()[0].toggle(); await render(); expect(request.cancelled).toBe(true); notify(); await idle(); expect(memory.activation('tea', 'i0')).toBe('manual-closed'); http.expectNone(() => true); cards()[0].toggle(); await render(); expect(memory.activation('tea', 'i0')).toBe('manual-open'); respond(); }); it('una compañera cerrada manualmente permanece cerrada', async () => { memory.rememberActivation('tea', 'i1', 'manual-closed'); await load(); positions([[200, 0], [200, 650], [1000, 0], [1000, 650], [1200, 0]]); notify(); await confirm(); expect(cards().map(card => card.expanded)).toEqual([true, false, false, false, false]); respond(); await idle(); }); it.each(['tea', 'cacu', 'cama'] as const)('singleton %s espera visibilidad antes de consultar', async domain => { if (domain !== 'tea') { http.expectOne('/tea/indicadores'); page.changeDominio(domain); } await load([items[0]], domain); await idle(); http.expectNone(() => true); expect(cards()[0].expanded).toBe(false); positions([[200, 0]]); notify(); await confirm(); expect(memory.activation(domain, 'i0')).toBe('auto-open'); respond(); await idle(); }); it('regresar conserva abierto sin montar fuera del viewport, y carga al entrar', async () => { await load([items[0]]); positions([[200, 0]]); notify(); await confirm(); respond(); page.changeDominio('cacu'); await load([items[0]], 'cacu'); await idle(); expect(cards()[0].expanded).toBe(false); page.changeDominio('tea'); await load([items[0]]); await idle(); expect(cards()[0].expanded).toBe(true); expect(cards()[0].awaitingFigures).toBe(true); expect(panels()).toHaveLength(0); http.expectNone(() => true); expect(fixture.nativeElement.textContent).toContain('Apertura recordada'); positions([[200, 0]]); notify(); await confirm(); expect(panels()).toHaveLength(1); respond(); await idle(); expect(memory.activation('tea', 'i0')).toBe('auto-open'); }); it('fallback manual permite mostrar figuras restauradas al primer clic y cerrar al siguiente', async () => { http.expectOne('/tea/indicadores'); fixture.destroy(); vi.stubGlobal('IntersectionObserver', undefined); create(); memory.rememberActivation('tea', 'i0', 'auto-open'); await load([items[0]]); expect(IntersectionControl.instances).toHaveLength(0); http.expectNone(() => true); const button = fixture.nativeElement.querySelector('app-indicador-catalog-card header button') as HTMLButtonElement; expect(button.getAttribute('aria-expanded')).toBe('true'); expect(button.getAttribute('aria-label')).toContain('Mostrar figuras'); button.focus(); button.click(); await render(); expect(document.activeElement).toBe(button); expect(panels()).toHaveLength(1); respond(); button.click(); await render(); expect(button.getAttribute('aria-expanded')).toBe('false'); expect(panels()).toHaveLength(0); http.expectNone(() => true); button.click(); await render(); expect(panels()).toHaveLength(1); respond(); }); it('búsqueda activa indirectamente una pendiente visible y conserva cierre manual al limpiar', async () => { memory.rememberActivation('tea', 'i0', 'manual-closed'); await load(); await idle(); const original = cards(); page.changeSearchQuery('Indicador 4'); await render(); expect(cards()[0]).toBe(original[4]); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); http.expectNone(() => true); notify(); await confirm(); respond(); page.changeSearchQuery(''); await render(); expect(cards()).toEqual(original); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await idle(); expect(cards()[0].expanded).toBe(false); expect(cards()[4].expanded).toBe(true); http.expectNone(() => true); }); it('reordenar una pendiente fuera de vista no autoriza carga con callback antiguo', async () => { await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); const target = cards()[0].visibilityHeader.nativeElement; notify(); await frame(); page.changeSearchQuery('Indicador 4'); await render(); positions([[1000, 0], [1200, 0], [1400, 0], [1600, 0], [1800, 0]]); observer().emit(target); await idle(); expect(cards().every(card => !card.expanded)).toBe(true); http.expectNone(() => true); }); it('retirar tarjetas desobserva sus cabeceras y descarta callbacks tardíos', async () => { await load(); const retired = cards()[0].visibilityHeader.nativeElement, active = observer(); page.catalog.set(items.slice(1)); await render(); expect(active.unobserve).toHaveBeenCalledWith(retired); active.emit(retired); await idle(); http.expectNone(() => true); }); it('cambiar de dominio cancela HTTP e ignora el observer saliente', async () => { await load([items[0]]); positions([[200, 0]]); notify(); await confirm(); const request = http.expectOne(r => r.url.includes('/figuras/')), old = observer(), target = cards()[0].visibilityHeader.nativeElement; page.changeDominio('cama'); await load([items[0]], 'cama'); expect(request.cancelled).toBe(true); expect(old.disconnect).toHaveBeenCalled(); old.emit(target); await idle(); http.expectNone(() => true); }); it('destruir desconecta observers, cancela frames y hace inocuos callbacks tardíos', async () => { await load(); const active = observer(), target = cards()[0].visibilityHeader.nativeElement; positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); notify(); await frame(); const sizeObserver = ResizeControl.instances.find(instance => instance.targets.has(sticky))!; const scheduled = new Set(frames.keys()); const cancellations = vi.mocked(window.cancelAnimationFrame).mock.calls.length; fixture.destroy(); expect(active.disconnect).toHaveBeenCalled(); expect(sizeObserver.disconnect).toHaveBeenCalled(); const cancelled = vi.mocked(window.cancelAnimationFrame).mock.calls.slice(cancellations).map(([id]) => id); expect(cancelled.some(id => scheduled.has(id))).toBe(true); for (const id of cancelled) expect(frames.has(id)).toBe(false); // Angular/Material can own another global frame; late page callbacks must add none. const remaining = frames.size; active.emit(target); sizeObserver.emit(); window.dispatchEvent(new Event('scroll')); expect(frames.size).toBe(remaining); http.expectNone(() => true); }); it('varias figuras mantienen errores y resultados independientes y se cancelan al cerrar', async () => { await load([{ ...items[0], figuras: ['f', 'g', 'h'] }]); positions([[200, 0]]); notify(); await confirm(); const requests = http.match(r => r.url.includes('/figuras/')); expect(requests).toHaveLength(3); requests[0].flush('private', { status: 500, statusText: 'Error' }); requests[1].flush({ data: [{ y: [2] }], layout: {} }); await render(); expect(panels().map(panel => panel.result().status)).toEqual(['error', 'ready', 'loading']); const filters = fixture.debugElement.query(By.directive(IndicadorPeriodFilters)).componentInstance as IndicadorPeriodFilters; 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(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(); await load([items[0]]); expect(cards()[0].expanded).toBe(false); http.expectNone(() => true); const button = fixture.nativeElement.querySelector('app-indicador-catalog-card header button') as HTMLButtonElement; for (const key of ['Tab', 'Enter', ' ']) { const event = new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true }); button.dispatchEvent(event); expect(event.defaultPrevented).toBe(false); } button.click(); await render(); expect(memory.activation('tea', 'i0')).toBe('manual-open'); respond(); button.click(); await render(); expect(memory.activation('tea', 'i0')).toBe('manual-closed'); http.expectNone(() => true); }); it('la activación protegida nunca sobrescribe una decisión manual', async () => { memory.rememberActivation('tea', 'i0', 'manual-closed'); memory.rememberActivation('tea', 'i1', 'manual-open'); await load(); cards()[0].activateVisible(); cards()[1].activateVisible(); await render(); expect(memory.activation('tea', 'i0')).toBe('manual-closed'); expect(cards()[0].expanded).toBe(false); expect(memory.activation('tea', 'i1')).toBe('manual-open'); expect(cards()[1].figuresActivated).toBe(true); respond(); cards()[1].activateVisible(); await render(); http.expectNone(() => true); }); it('scroll progresivo reactiva evaluación sin mantener un bucle cuando todo está fuera', async () => { await load(); await idle(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); window.dispatchEvent(new Event('scroll')); await confirm(); respond(); await idle(); positions([[-1000, 0], [200, 0], [1200, 0], [1400, 0], [1600, 0]]); window.dispatchEvent(new Event('scroll')); await confirm(); respond(); await idle(); expect(cards().map(card => card.expanded)).toEqual([true, true, false, false, false]); http.expectNone(() => true); }); it('búsqueda reconstruye la fila visual usando las mismas instancias', async () => { await load(); await idle(); const before = cards(); page.changeSearchQuery('Indicador 4'); await render(); positions([[200, 0], [200, 650], [1000, 0], [1000, 650], [1200, 0]]); notify(); await confirm(); respond(); await idle(); expect(memory.activation('tea', 'i4')).toBe('auto-open'); expect(memory.activation('tea', 'i0')).toBe('auto-open'); expect(memory.activation('tea', 'i1')).toBe('pending'); expect(cards().every(card => before.includes(card))).toBe(true); http.expectNone(() => true); }); it('una cabecera fuera horizontalmente no se considera visible', async () => { await load([items[0]]); positions([[200, 1500]]); notify(); await idle(); expect(cards()[0].expanded).toBe(false); http.expectNone(() => true); }); it('visibilidad y búsqueda conservan hosts Plotly, resultados y foco sin react ni purge repetidos', async () => { http.expectOne('/tea/indicadores'); fixture.destroy(); TestBed.resetTestingModule(); TestBed.configureTestingModule({ imports: [IndicadoresPage], providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: PLOTLY_LOADER, useValue: () => Promise.resolve(runtime) }] }); create(); await load(); positions([[200, 0], [1000, 0], [1200, 0], [1400, 0], [1600, 0]]); const input = fixture.nativeElement.querySelector('.catalog-search input') as HTMLInputElement; input.focus(); notify(); await confirm(); respond(); await render(); for (let i = 0; i < 12; i++) await Promise.resolve(); await render(); const chart = fixture.debugElement.query(By.directive(PlotlyChart)).componentInstance as PlotlyChart; const host = chart.host.nativeElement, panel = panels()[0], result = panel.result(), reacts = runtime.react.mock.calls.length; expect(reacts).toBe(1); expect(document.activeElement).toBe(input); page.changeSearchQuery('Indicador 0'); await render(); notify(); await idle(); expect(fixture.debugElement.query(By.directive(PlotlyChart)).componentInstance.host.nativeElement).toBe(host); 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); }); });