feat(ui): integrar grid y KPI preliminares UX-06E.D.1
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { IndicadorKpiCard } from './indicador-kpi-card';
|
||||
|
||||
describe('UX-06E.D.1 KPI presentacional', () => {
|
||||
it('presenta título y definición pendiente sin valores, unidades, fechas ni controles', () => {
|
||||
const fixture = TestBed.createComponent(IndicadorKpiCard);
|
||||
fixture.componentRef.setInput('title', 'Indicador destacado 1'); fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('h3').textContent).toBe('Indicador destacado 1');
|
||||
expect(fixture.nativeElement.querySelector('.kpi-state').textContent).toBe('Pendiente de definición');
|
||||
expect(fixture.nativeElement.querySelector('.value')).toBeNull();
|
||||
expect(fixture.nativeElement.querySelectorAll('p')).toHaveLength(1);
|
||||
expect(fixture.nativeElement.querySelector('button, input, app-plotly-chart')).toBeNull();
|
||||
fixture.destroy();
|
||||
});
|
||||
it.each([null, undefined])('omite el valor opcional %s sin convertirlo a cero', value => {
|
||||
const fixture = TestBed.createComponent(IndicadorKpiCard);
|
||||
fixture.componentRef.setInput('title', 'Presentación'); fixture.componentRef.setInput('value', value);
|
||||
fixture.detectChanges(); expect(fixture.nativeElement.querySelector('.value')).toBeNull(); fixture.destroy();
|
||||
});
|
||||
it('admite contenido opcional suministrado por su consumidor sin servicios ni formatos impuestos', () => {
|
||||
const fixture = TestBed.createComponent(IndicadorKpiCard);
|
||||
for (const [name, value] of Object.entries({ title: 'Título de prueba', value: 'Valor de prueba', unit: 'Unidad de prueba',
|
||||
temporalReference: 'Referencia de prueba', state: 'Estado de prueba', additionalInfo: 'Información de prueba' })) {
|
||||
fixture.componentRef.setInput(name, value);
|
||||
}
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.querySelector('.value').textContent).toContain('Valor de prueba');
|
||||
expect(fixture.nativeElement.querySelector('.value span').textContent).toBe('Unidad de prueba');
|
||||
expect(fixture.nativeElement.textContent).toContain('Referencia de prueba');
|
||||
expect(fixture.nativeElement.querySelector('.kpi-state').textContent).toBe('Estado de prueba');
|
||||
expect(fixture.nativeElement.querySelector('.additional-info').textContent).toBe('Información de prueba');
|
||||
fixture.destroy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user