56d1ef2e8a
Plotly partial bundle (bar, scatter, box, pie, sankey, contour) replacing the cartesian dist; card-actions (published Measure definitions, settings, Volver); Descargar reporte with a print stylesheet; export module: xlsx with frozen header, autofilter, Parámetros sheet and 5,000-row cap, pdfmake documents with header/footer, allRows following next links, file names without patient identifiers; lazy-loaded export libraries. Checks on milkpc (node:22): npm ci, ng build (initial 567 kB / 134 kB transfer), ng test 7 files passed.
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import { TestBed } from '@angular/core/testing';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
import { describe, expect, it, vi } from 'vitest';
|
|
import { CardActions } from './card-actions';
|
|
|
|
describe('CardActions', () => {
|
|
it('opens the published definition and emits back only through the filtered action', async () => {
|
|
const fixture = TestBed.createComponent(CardActions);
|
|
fixture.componentRef.setInput('measures', [
|
|
{
|
|
resourceType: 'Measure',
|
|
status: 'active',
|
|
title: 'Oportunidad',
|
|
description: 'Definición publicada',
|
|
group: [
|
|
{
|
|
population: [
|
|
{
|
|
code: { text: 'Numerador' },
|
|
criteria: { language: 'text/plain', description: 'Casos oportunos' },
|
|
},
|
|
{ criteria: { language: 'text/plain' } },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]);
|
|
const back = vi.fn();
|
|
fixture.componentInstance.back.subscribe(back);
|
|
fixture.detectChanges();
|
|
|
|
const host: HTMLElement = fixture.nativeElement;
|
|
expect(host.textContent).not.toContain('Volver');
|
|
host.querySelector<HTMLButtonElement>('[aria-label="Ver definición"]')!.click();
|
|
fixture.detectChanges();
|
|
await fixture.whenStable();
|
|
|
|
const dialog = document.querySelector('[role="dialog"]')!;
|
|
expect(dialog.textContent).toContain('Oportunidad');
|
|
expect(dialog.textContent).toContain('Definición publicada');
|
|
expect(dialog.textContent).toContain('Numerador');
|
|
expect(dialog.textContent).toContain('Casos oportunos');
|
|
expect(dialog.textContent).toContain('Sin definición publicada');
|
|
TestBed.inject(MatDialog).closeAll();
|
|
|
|
fixture.componentRef.setInput('filtered', true);
|
|
fixture.detectChanges();
|
|
[...host.querySelectorAll('button')]
|
|
.find((button) => button.textContent?.trim() === 'Volver')!
|
|
.click();
|
|
expect(back).toHaveBeenCalledOnce();
|
|
});
|
|
});
|