Compare commits

..

2 Commits

2 changed files with 15 additions and 1 deletions
@@ -7,10 +7,12 @@
@if (m.escenarios.length === 0) { <p role="status">Todavía no hay escenarios clínicos con pacientes suficientes para mostrar.</p> }
@else {
<label class="selector">Escenario clínico
<select [value]="escenario()" (change)="elegir($any($event.target).value)">
<select [value]="escenario() ?? ''" (change)="elegir($any($event.target).value)">
@if (escenario() === null) { <option value="" selected disabled>Elige un escenario…</option> }
@for (e of m.escenarios; track e.nombre) { <option [value]="e.nombre" [selected]="e.nombre === escenario()">{{ e.nombre }}</option> }
</select>
</label>
@if (escenario() === null) { <p role="status">La paciente no pertenece a ningún escenario clínico con pacientes suficientes; elige uno para ver su curva.</p> }
@let l = lectura();
@if (l?.tipo === 'cargando') { <p role="status">Calculando con los datos más recientes…</p> }
@if (l?.tipo === 'rechazada') { <p role="status">{{ $any(l).motivo }}</p> }
@@ -99,6 +99,18 @@ describe('Análisis de supervivencia', () => {
expect([...(f.nativeElement as HTMLElement).querySelectorAll('h5')].map(h => h.textContent!.trim())).toEqual(['Análisis de supervivencia', 'Factores de riesgo']);
});
// Fails if a patient in no drawable scenario gets another subgroup's curve instead of a prompt to choose one.
it('draws nothing and asks to choose when the patient belongs to no scenario', () => {
TestBed.resetTestingModule();
TestBed.configureTestingModule({ providers: [plotly(), { provide: CamaCurvasService, useValue: {
escenarios: () => of({ escenarios: [{ nombre: '< 45 años', n: 100 }], predeterminado: null }), consulta } }] });
const f = montar();
expect(consulta).not.toHaveBeenCalled();
expect(f.nativeElement.querySelectorAll('app-plotly-chart')).toHaveLength(0);
expect(texto(f)).toContain('no pertenece a ningún escenario clínico');
});
// Fails if choosing a scenario changes only the curve or only the label: the selector decides both at once, one scenario at a time.
it('changes the curve and the label together when another scenario is chosen, and never draws two', () => {
const f = montar();