feat(web): el indicador del documento se elige de su ventana de selección (FactoringIndicators)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
02c231a662
commit
d1cafcd721
6 files changed
+56
-4
No files matched your search
@@ -245,3 +245,42 @@ describe('el proyecto de la cabecera se elige de su ventana modal', () => {
|
||||
expect(fixture.componentInstance['header']()['Project']).toBe('PE001');
|
||||
});
|
||||
});
|
||||
|
||||
describe('el indicador de la cabecera se elige de su ventana modal', () => {
|
||||
it('es un campo con lista de valores sobre FactoringIndicators, con código y nombre', () => {
|
||||
const f = DOCUMENT_SCREENS.find((s) => s.path === '/ventas/facturas')!.layout.header.left.find((x) => x.type === 'lookup' && x.key === 'Indicator');
|
||||
expect(f && f.type === 'lookup' && f.lookup.resource).toBe('FactoringIndicators');
|
||||
expect(f && f.type === 'lookup' && f.lookup.columns.map((c) => c.key)).toEqual(['IndicatorCode', 'IndicatorName']);
|
||||
});
|
||||
|
||||
it('abre su ventana de selección y escribe el código elegido', async () => {
|
||||
TestBed.resetTestingModule();
|
||||
const screen = DOCUMENT_SCREENS.find((s) => s.path === '/ventas/facturas')!;
|
||||
const route = {
|
||||
snapshot: { data: { screen, title: 'Documento' }, paramMap: convertToParamMap({}) },
|
||||
paramMap: of(convertToParamMap({})),
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DocumentFormPage],
|
||||
providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: ActivatedRoute, useValue: route }],
|
||||
}).compileComponents();
|
||||
const ctrl = TestBed.inject(HttpTestingController);
|
||||
const fixture = TestBed.createComponent(DocumentFormPage);
|
||||
const tick = async () => {
|
||||
fixture.detectChanges();
|
||||
await new Promise((r) => setTimeout(r));
|
||||
fixture.detectChanges();
|
||||
};
|
||||
await tick();
|
||||
const el = fixture.nativeElement as HTMLElement;
|
||||
const row = [...el.querySelectorAll('sbo-lookup-field')].find((f) => f.querySelector('label')?.textContent?.trim() === 'Indicador')!;
|
||||
expect(row, 'campo Indicador con lista').toBeDefined();
|
||||
(row.querySelector('button.sbo-btn') as HTMLElement).click();
|
||||
await tick();
|
||||
ctrl.expectOne((r) => r.url === '/api/sl/FactoringIndicators').flush({ value: [{ IndicatorCode: '33', IndicatorName: 'Factura' }, { IndicatorCode: '39', IndicatorName: 'Boleta' }], 'odata.count': '2' });
|
||||
await tick();
|
||||
(el.querySelectorAll('.dlg tbody tr')[1] as HTMLElement).click();
|
||||
await tick();
|
||||
expect(fixture.componentInstance['header']()['Indicator']).toBe('39');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user