WebApp shared: Plotly partial bundle, card actions, print report, export module
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.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user