import { periodAvailabilityProvider } from './indicadores-periodos.testing'; 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 { IndicadoresTracking } from './indicadores-tracking'; import { IndicadorCatalogCard } from './indicador-catalog-card'; import { IndicadorFigurePanel } from './indicador-figure-panel'; import { IndicadorFigureCard } from './indicador-figure-card'; import { IndicadorPeriodFilters } from './indicador-period-filters'; import { MatSelect } from '@angular/material/select'; import { NgModel } from '@angular/forms'; import { IndicadoresMemory } from './indicadores-memory'; import { PlotlyChart } from '../../shared/plotly/plotly-chart'; import { Indicador, PlotlyFigure } from './indicadores.models'; import { syntheticCatalogs } from './indicadores.synthetic-fixtures'; @Component({ selector: 'app-plotly-chart', inputs: ['figure', 'label', 'showNotes'], template: '' }) class ChartStub { figure?: PlotlyFigure; } const item: Indicador = { id: 'i1', titulo: 'Uno', contrato: 'C1', figuras: ['f1', 'f2'], tipos_periodo: ['semestre', 'mes'] }; const second: Indicador = { ...item, id: 'i2', titulo: 'Dos', figuras: ['g'] }; describe('UX-06E.D.3.A catálogo permanentemente desplegado', () => { let fixture: ReturnType>; let page: IndicadoresPage; let http: HttpTestingController; beforeEach(() => { vi.stubGlobal('IntersectionObserver', class { observe() {} unobserve() {} disconnect() {} }); TestBed.configureTestingModule({ imports: [IndicadoresPage], providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting(), periodAvailabilityProvider] }); TestBed.overrideComponent(IndicadorFigureCard, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } }); fixture = TestBed.createComponent(IndicadoresPage); page = fixture.componentInstance; vi.spyOn(page as unknown as { evaluateVisibility(): void }, 'evaluateVisibility').mockImplementation(() => {}); http = TestBed.inject(HttpTestingController); }); afterEach(() => { http.match(r => r.url.endsWith('/datos')).forEach(r => r.flush('missing', { status: 404, statusText: 'Not Found' })); fixture.destroy(); http.verify(); vi.restoreAllMocks(); vi.unstubAllGlobals(); }); function load(items: Indicador[] = [item, second], domain = 'tea') { http.expectOne('/' + domain + '/indicadores').flush(items); fixture.detectChanges(); } 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).filter(p => p.result().status !== 'deferred'); } function toggle(index = 0) { cards()[index].setVisible(true); fixture.detectChanges(); } function request(figure: string) { return http.expectOne(r => r.url.endsWith('/figuras/' + figure)); } function flushAll() { http.match(r => r.url.includes('/figuras/')).forEach(r => r.flush({ data: [{ y: [0, null] }], layout: {} })); fixture.detectChanges(); } function kpiMissing() { http.match(r => r.url.endsWith('/datos')).forEach(r => r.flush('missing', { status: 404, statusText: 'Not Found' })); fixture.detectChanges(); } function control(index = 0) { return fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))[index].componentInstance as IndicadorPeriodFilters; } it('no presenta destacados retirados del catálogo ni consulta sus datos', () => { load(); expect(fixture.nativeElement.querySelector('#kpi-section-title')).toBeNull(); expect(Array.from(fixture.nativeElement.querySelectorAll('.kpi-grid app-indicador-kpi-card h3')).map(h => (h as HTMLElement).textContent)) .toEqual([]); http.expectNone(r => r.url.endsWith('/datos')); }); 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.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.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.querySelectorAll('.section-tabs [role="tab"]')).toHaveLength(4); expect(fixture.nativeElement.querySelector('#panel-seguimiento')?.getAttribute('aria-labelledby')).toBe('tab-seguimiento'); expect(page.activeSection()).toBe('resumen'); http.expectNone(() => true); }); it('KPI-DYNAMIC distingue carga, error y catálogo vacío confirmado', () => { fixture.detectChanges(); expect(page.catalogLoading()).toBe(true); expect(fixture.nativeElement.textContent).toContain('Cargando catálogo'); expect(fixture.nativeElement.textContent).not.toContain('No hay indicadores disponibles'); http.expectOne('/tea/indicadores').flush('private', { status: 500, statusText: 'Error' }); fixture.detectChanges(); expect(page.catalogError()).toBeTruthy(); expect(fixture.nativeElement.querySelector('[role="alert"]')).toBeTruthy(); expect(fixture.nativeElement.textContent).not.toContain('No hay indicadores disponibles'); page.retryCatalog(); fixture.detectChanges(); load([]); expect(page.catalogLoading()).toBe(false); expect(page.catalogError()).toBe(''); expect(fixture.nativeElement.textContent).toContain('No hay indicadores disponibles'); expect(fixture.nativeElement.querySelectorAll('.kpi-section app-indicador-kpi-card')).toHaveLength(0); http.expectNone(() => true); }); it('D.1 separa secciones y conserva tarjetas, orden, identidades y figuras dentro del grid', () => { load(); const before = cards(); const grid = fixture.nativeElement.querySelector('.catalog-grid') as HTMLElement; expect(getComputedStyle(grid).display).toBe('grid'); expect(grid.children).toHaveLength(2); expect(Array.from(grid.children).every(host => host.tagName === 'APP-INDICADOR-CATALOG-CARD')).toBe(true); const sections = fixture.nativeElement.querySelectorAll('#panel-resumen > section') as NodeListOf; expect(Array.from(sections).map(section => section.getAttribute('aria-labelledby'))).toEqual(['global-filters-title', 'graphic-section-title']); // Cada figura trae su tabla de valores: no hay resumen de indicadores al final de la página. expect(fixture.nativeElement.querySelector('app-indicadores-numeric-summary')).toBeNull(); expect(fixture.nativeElement.querySelector('.catalog-count').textContent.trim()).toBe('2 indicadores publicados'); expect(getComputedStyle(fixture.nativeElement.querySelector('.catalog-count')).textAlign).toBe('right'); toggle(0); toggle(1); flushAll(); expect(Array.from(grid.children).map(host => host.querySelectorAll('app-indicador-figure-panel').length)).toEqual([1, 1]); expect(panels().map(panel => panel.figuraId)).toEqual(['f1', 'g']); expect(cards()).toEqual(before); expect(cards().every(card => card.visible)).toBe(true); http.expectNone(() => true); }); it('D.3.A muestra identidad y skeleton sin control de expansión ni HTTP', () => { load(); const host = fixture.nativeElement.querySelector('app-indicador-catalog-card'); expect(host.querySelector('h2').textContent).toBe('Uno'); expect(host.querySelector('header button')).toBeNull(); 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'); http.expectNone(() => true); }); it('Resumen omite los indicadores publicados solo para otra pestaña', () => { load([item, { ...second, vistas: ['historico'] }]); expect(page.searchResults().items.map(i => i.id)).toEqual([item.id]); expect(fixture.nativeElement.querySelector('.catalog-count').textContent).toContain('1 indicadores'); expect(page.catalog()).toHaveLength(2); http.expectNone(r => r.url.endsWith('/figuras/f1')); }); it('D.3.A conserva encabezado y contenido al salir del viewport', () => { load(); const host = fixture.nativeElement.querySelector('app-indicador-catalog-card'); 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); }); 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.querySelector('button')).toBeNull(); expect(fixture.nativeElement.querySelector('.pin-toggle').getAttribute('aria-label')).toContain(title); http.expectNone(() => true); }); it('UX-06B mantiene una sola navegación entre dominios, sin duplicar botones', () => { // Our shell has no domain selector of its own (unlike upstream's App), // so the page keeps exactly the one it always had -- not duplicated. // (Needs a render pass first: unlike upstream's trivial "absent" check, // confirming presence requires the template to have actually painted.) fixture.detectChanges(); expect(fixture.nativeElement.querySelectorAll('nav.domain-nav')).toHaveLength(1); expect(fixture.nativeElement.querySelectorAll('nav.domain-nav a')).toHaveLength(3); 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 () => { load(); await fixture.whenStable(); fixture.detectChanges(); expect(fixture.nativeElement.querySelector('.global-filters mat-select')).toBeTruthy(); expect(fixture.nativeElement.textContent).not.toContain('Tema del dominio'); expect(page.tema).toBe('claro'); page.changeTema('oscuro'); fixture.detectChanges(); expect(page.tema).toBe('oscuro'); expect(cards().every(card => !card.visible)).toBe(true); http.expectNone(() => true); }); it.each([0, 1, 2, 18, 37])('catálogo de %i conserva orden y no consulta figuras inicialmente', count => { const items = Array.from({ length: count }, (_, i) => ({ ...item, id: 'id-' + i })); load(items); expect(cards().map(c => c.indicador.id)).toEqual(items.map(i => i.id)); expect(cards().every(c => !c.visible)).toBe(true); expect(panels()).toHaveLength(0); http.expectNone(r => r.url.includes('/figuras/')); if (!count) expect(fixture.nativeElement.textContent).toContain('No hay indicadores disponibles'); }); it('activar visibilidad consulta exactamente una vez la primera figura publicada', () => { load([item]); toggle(); expect(cards()[0].visible).toBe(true); expect(panels()).toHaveLength(1); request('f1').flush({ data: [], layout: {} }); fixture.detectChanges(); fixture.detectChanges(); http.expectNone(() => true); }); it('volver al dominio espera nueva visibilidad sin memoria de cierre', () => { load([item]); toggle(); flushAll(); fixture.destroy(); fixture = TestBed.createComponent(IndicadoresPage); page = fixture.componentInstance; vi.spyOn(page as unknown as { evaluateVisibility(): void }, 'evaluateVisibility').mockImplementation(() => {}); load([item]); expect(cards()[0].visible).toBe(false); http.expectNone(() => true); }); it('indicador sin figuras informa y no consulta HTTP', () => { load([{ ...item, figuras: [] }]); toggle(); expect(cards()[0].visible).toBe(true); expect(fixture.nativeElement.textContent).toContain('no tiene figuras disponibles'); expect(panels()).toHaveLength(0); http.expectNone(() => true); }); it('varias tarjetas y figuras abiertas mantienen solicitudes concurrentes independientes', () => { load(); toggle(0); const a = request('f1'); toggle(1); const c = request('g'); expect(a.cancelled).toBe(false); c.flush({ data: [{ y: [3] }], layout: {} }); a.flush({ data: [{ y: [1] }], layout: {} }); expect(panels().map(p => p.result().figure?.data[0]['y'])).toEqual([[1], [3]]); expect(cards().every(c => c.visible)).toBe(true); }); it('retirar una tarjeta cancela solo su solicitud y destruye su panel', () => { load(); toggle(); toggle(1); const a = request('f1'), c = request('g'); page.catalog.set([second]); fixture.detectChanges(); expect(a.cancelled).toBe(true); expect(c.cancelled).toBe(false); expect(() => a.flush({ data: [{ y: [99] }], layout: {} })).toThrow(); expect(panels()).toHaveLength(1); c.flush({ data: [{ y: [3] }], layout: {} }); expect(panels()[0].result().figure?.data[0]['y']).toEqual([3]); }); it('404 y reintento afectan solo una figura y 200 sin puntos sigue siendo resultado', () => { load(); toggle(); toggle(1); const a = request('f1'), b = request('g'); a.flush('private', { status: 404, statusText: 'Not Found' }); b.flush({ data: [{ y: [null] }], layout: {} }); fixture.detectChanges(); expect(panels()[0].result().status).toBe('error'); expect(panels()[1].result().status).toBe('ready'); expect(fixture.nativeElement.textContent).toContain('No hay valores visibles'); panels()[0].requestFigure(); request('f1').flush({ data: [], layout: {} }); http.expectNone(() => true); }); it('un único borrador actualiza todas las figuras y tema usa aplicado', () => { load([item]); toggle(); flushAll(); const a = control(); expect(fixture.debugElement.queryAll(By.directive(IndicadorPeriodFilters))).toHaveLength(1); a.select([]); a.year = '2025'; a.unit = 'S1'; a.add(); http.expectNone(() => true); page.applyFilters(); fixture.detectChanges(); const appliedA = request('f1'); expect(appliedA.request.params.get('periodos')).toBe('2025-S1'); appliedA.flush({ data: [], layout: {} }); kpiMissing(); a.year = '2025'; a.unit = 'S2'; a.add(); page.changeTema('oscuro'); fixture.detectChanges(); const themedA = request('f1'); expect(themedA.request.params.get('periodos')).toBe('2025-S1'); expect(themedA.request.params.get('tema')).toBe('oscuro'); expect(a.selectedPeriods).toEqual(['2025-S2']); themedA.flush({ data: [], layout: {} }); }); it('UX-06D expandir metodología carga metadatos una vez y conserva panel, figura y borrador', () => { load([{ ...item, contrato: 'C2', figuras: ['fig_c2_apiladas'] }]); toggle(); flushAll(); const panel = panels()[0], chart = fixture.debugElement.query(By.directive(ChartStub)).componentInstance; const filters = control(); filters.select([]); filters.year = '2025'; filters.unit = 'S1'; filters.add(); const draft = structuredClone(filters.entry.draft), applied = structuredClone(page.filters!.applied); const result = panel.result(); const button = fixture.nativeElement.querySelector('.methodology-toggle') as HTMLButtonElement; for (let i = 0; i < 2; i++) { button.click(); fixture.detectChanges(); if (i === 0) { http.expectOne(r => r.url === '/tea/indicadores/i1/metadatos').flush({}); fixture.detectChanges(); } expect(button.getAttribute('aria-expanded')).toBe(i === 0 ? 'true' : 'false'); expect(panels()[0]).toBe(panel); expect(panel.result()).toBe(result); expect(fixture.debugElement.query(By.directive(ChartStub)).componentInstance).toBe(chart); expect(filters.entry.draft).toEqual(draft); expect(page.filters!.applied).toEqual(applied); http.expectNone(() => true); } }); it('salir y volver al viewport conserva borrador, aplicado y resultado sin HTTP redundante', () => { load([item]); toggle(); flushAll(); const a = control(); a.select([]); a.year = '2025'; a.unit = 'S1'; a.add(); page.applyFilters(); fixture.detectChanges(); flushAll(); kpiMissing(); a.year = '2025'; a.unit = 'S2'; a.add(); cards()[0].setVisible(false); fixture.detectChanges(); toggle(); expect(control()).toBe(a); expect(control().selectedPeriods).toEqual(['2025-S2']); http.expectNone(() => true); }); it('tema solo consulta paneles visibles, cancela los anteriores y no repite el mismo tema', () => { load(); toggle(); const a = request('f1'); page.changeTema('oscuro'); fixture.detectChanges(); expect(a.cancelled).toBe(true); const darkA = request('f1'); expect(darkA.request.params.get('tema')).toBe('oscuro'); http.expectNone(r => r.url.endsWith('/g')); darkA.flush({ data: [], layout: {} }); page.changeTema('oscuro'); fixture.detectChanges(); http.expectNone(() => true); toggle(1); const later = request('g'); expect(later.request.params.get('tema')).toBe('oscuro'); later.flush({ data: [], layout: {} }); }); it('salir del dominio cancela paneles y catálogos obsoletos', () => { load(); toggle(); const a = request('f1'); page.changeDominio('cacu'); fixture.detectChanges(); expect(a.cancelled).toBe(true); const oldCatalog = http.expectOne('/cacu/indicadores'); page.changeDominio('cama'); fixture.detectChanges(); expect(oldCatalog.cancelled).toBe(true); load(syntheticCatalogs.cama, 'cama'); flushAll(); expect(() => oldCatalog.flush(syntheticCatalogs.cacu)).toThrow(); expect(page.dominio).toBe('cama'); }); it('restaura representación y tema de dominio sin aplicar borrador pendiente', () => { load(); toggle(); flushAll(); control().select([]); page.changeTema('oscuro'); fixture.detectChanges(); flushAll(); page.changeDominio('cacu'); fixture.detectChanges(); load(syntheticCatalogs.cacu, 'cacu'); toggle(); flushAll(); toggle(); page.changeDominio('tea'); fixture.detectChanges(); load(); expect(cards()[0].visible).toBe(false); expect(cards()[1].visible).toBe(false); expect(page.tema).toBe('oscuro'); expect(cards()[0].visible).toBe(false); http.expectNone(() => true); toggle(); const a = request('f1'); expect(a.request.params.has('periodos')).toBe(false); expect(control().entry.draft.mode).toBe('empty'); a.flush({ data: [], layout: {} }); page.changeDominio('cacu'); fixture.detectChanges(); load(syntheticCatalogs.cacu, 'cacu'); expect(cards()[0].visible).toBe(false); expect(page.tema).toBe('claro'); http.expectNone(() => true); }); it('identidades estables conservan componentes al reordenar el catálogo', () => { load(); toggle(); flushAll(); const card = cards()[0], panel = panels()[0]; page.catalog.set([second, item]); fixture.detectChanges(); expect(cards()[1]).toBe(card); expect(panels()[0]).toBe(panel); http.expectNone(() => true); }); it('identidad eliminada no se monta aunque exista preferencia anterior', () => { TestBed.inject(IndicadoresMemory).rememberFigure('tea', 'removed', 'f1'); load([second]); expect(cards().map(c => c.indicador.id)).toEqual(['i2']); flushAll(); }); it('controles permanentes conservan IDs únicos y foco al salir del viewport', () => { load(); toggle(); flushAll(); const input = fixture.nativeElement.querySelector('app-indicador-catalog-card .methodology-toggle'); input.focus(); cards()[0].setVisible(false); fixture.detectChanges(); expect(document.activeElement).toBe(input); const ids = Array.from(fixture.nativeElement.querySelectorAll('[id]') as NodeListOf).map(e => e.id); expect(new Set(ids).size).toBe(ids.length); expect(fixture.nativeElement.querySelector('app-indicador-catalog-card header button')).toBeNull(); }); it('copia de presentación y gráficos independientes conservan JSON binario, notas, ceros y nulos', () => { load(); toggle(0); toggle(1); const raw = { data: [{ y: { dtype: 'f8', bdata: 'AAAAAAAAAAA=' }, customdata: [[0, null]] }], layout: { annotations: [{ text: 'Nota' }] } }; const before = JSON.stringify(raw); request('f1').flush(raw); request('g').flush({ data: [{ y: [0, null] }], layout: {} }); fixture.detectChanges(); expect(JSON.stringify(raw)).toBe(before); expect(panels()[0].result().figure).toEqual(raw); const charts = fixture.debugElement.queryAll(By.directive(ChartStub)); expect(charts).toHaveLength(2); expect(charts[0].componentInstance.figure).not.toBe(charts[1].componentInstance.figure); expect(panels()[0].result().presentationFigure).not.toBe(raw); expect(fixture.nativeElement.textContent).not.toContain('reportes no están disponibles'); }); it.each(['cacu', 'cama'] as const)('preserva advertencias y filtros mensuales de %s', domain => { load([]); page.changeDominio(domain); load(syntheticCatalogs[domain], domain); toggle(); flushAll(); const c = control(); c.changeTipo('mes'); c.year = '2025'; c.unit = '01'; c.add(); http.expectNone(() => true); page.applyFilters(); fixture.detectChanges(); const r = http.expectOne(r => r.url.includes('/figuras/')); expect(r.request.params.get('periodos')).toBe('2025-01'); r.flush({ data: [{ y: [0, null] }], layout: {} }); fixture.detectChanges(); expect(fixture.nativeElement.textContent).toContain('Cuando la figura publica intervalos Wilson al 95 %'); expect(fixture.nativeElement.textContent).toContain('suprimidos no representan tasas observadas de 0 %'); }); it('catálogo error, reintento y vacío no dejan paneles', () => { http.expectOne('/tea/indicadores').flush('private', { status: 500, statusText: 'Error' }); fixture.detectChanges(); expect(page.catalogError()).toContain('error interno'); expect(fixture.nativeElement.textContent).not.toContain('private'); page.retryCatalog(); load([]); expect(panels()).toHaveLength(0); }); it.each(['M02_sexo', 'K01_evaluacion_3_meses'])('UX-04A: %s conserva selección vacía estable al reabrir sin escrituras ni HTTP redundantes', async id => { load(syntheticCatalogs.tea); const index = cards().findIndex(c => c.indicador.id === id); toggle(index); flushAll(); const c = control(); c.select([]); fixture.detectChanges(); await fixture.whenStable(); expect(c.canApply).toBe(false); http.expectNone(() => true); c.year = '2025'; c.unit = 'S1'; c.add(); c.select([]); fixture.detectChanges(); await fixture.whenStable(); 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)!; 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(); expect(select.componentInstance.panelOpen).toBe(true); select.componentInstance.close(); fixture.detectChanges(); await fixture.whenStable(); } expect(writes).not.toHaveBeenCalled(); expect(saves).not.toHaveBeenCalled(); expect(panels()[0].result()).toBe(state); http.expectNone(() => true); }); it('UX-06D retira solo el aviso general del catálogo', () => { load(); expect(fixture.nativeElement.querySelector('.notice')).toBeNull(); expect(fixture.nativeElement.textContent).not.toContain('Uso exclusivo de investigación. No usar para decisiones clínicas.'); }); it('IDs distintos con el mismo título y figura conservan paneles y etiquetas independientes', () => { load([{ ...item, figuras: ['f1'] }, { ...second, titulo: item.titulo, figuras: ['f1'] }]); toggle(0); toggle(1); const a = http.expectOne(r => r.url.endsWith('/i1/figuras/f1')); const b = http.expectOne(r => r.url.endsWith('/i2/figuras/f1')); a.flush({ data: [{ y: [1] }], layout: {} }); b.flush({ data: [{ y: [2] }], layout: {} }); fixture.detectChanges(); expect(panels()[0].titleId).not.toBe(panels()[1].titleId); expect(panels().map(p => p.result().figure?.data[0]['y'])).toEqual([[1], [2]]); }); });