fix(web): el formulario de documentos dibuja los campos Sí/No (checkbox) de las extensiones
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7da6663e4b
commit
f25037f651
3 files changed
+54
-2
No files matched your search
@@ -344,3 +344,47 @@ describe('formulario con campos ocultos o de solo lectura', () => {
|
||||
expect(input('Indicador')!.readOnly).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('campos Sí/No (checkbox) en los documentos', () => {
|
||||
it('un campo de usuario de tipo casilla se dibuja como casilla y guarda tYES / tNO', async () => {
|
||||
TestBed.resetTestingModule();
|
||||
const screen = by(
|
||||
applyExtensions(BASE_SCREENS, { '/ventas/ordenes': { headerLeft: [{ type: 'checkbox', key: 'U_Urgente', label: 'Urgente' }] } }),
|
||||
'/ventas/ordenes',
|
||||
);
|
||||
const route = {
|
||||
snapshot: { data: { screen, title: 'Documento' }, paramMap: convertToParamMap({ docEntry: '5' }) },
|
||||
paramMap: of(convertToParamMap({ docEntry: '5' })),
|
||||
};
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [DocumentFormPage],
|
||||
providers: [provideRouter([]), provideHttpClient(), provideHttpClientTesting(), { provide: ActivatedRoute, useValue: route }],
|
||||
}).compileComponents();
|
||||
const ctrl = TestBed.inject(HttpTestingController);
|
||||
vi.spyOn(TestBed.inject(Router), 'navigate').mockResolvedValue(true);
|
||||
const fixture = TestBed.createComponent(DocumentFormPage);
|
||||
const tick = async () => {
|
||||
fixture.detectChanges();
|
||||
await new Promise((r) => setTimeout(r));
|
||||
fixture.detectChanges();
|
||||
};
|
||||
await tick();
|
||||
ctrl.match((r) => r.url === '/api/sl/SalesTaxCodes').forEach((r) => r.flush({ value: [] }));
|
||||
ctrl.match((r) => r.url === '/api/sl/AdditionalExpenses').forEach((r) => r.flush({ value: [] }));
|
||||
ctrl.match((r) => r.url.includes('SeriesService')).forEach((r) => r.flush({ value: [] }));
|
||||
ctrl.expectOne('/api/sl/Orders/5').flush({
|
||||
'odata.etag': 'W/"1"', DocEntry: 5, DocNum: 5, CardCode: 'C1', CardName: 'ACME', U_Urgente: 'tNO',
|
||||
DocDate: '2026-09-11T00:00:00Z', DocDueDate: '2026-09-20T00:00:00Z', DocumentStatus: 'bost_Open', Cancelled: 'tNO',
|
||||
DocumentLines: [{ LineNum: 0, ItemCode: 'A1', ItemDescription: 'Pieza', Quantity: 1, Price: 10, TaxCode: '', LineTotal: 10 }],
|
||||
});
|
||||
await tick();
|
||||
const el = fixture.nativeElement as HTMLElement;
|
||||
const box = [...el.querySelectorAll('sbo-checkbox-field')].find((f) => f.querySelector('label')?.textContent?.trim() === 'Urgente')!.querySelector('input[type=checkbox]') as HTMLInputElement;
|
||||
expect(box.checked).toBe(false);
|
||||
box.click();
|
||||
await tick();
|
||||
(el.querySelector('.actions .btn.main') as HTMLElement).click();
|
||||
await tick();
|
||||
expect(ctrl.expectOne((r) => r.method === 'PATCH').request.body).toEqual({ U_Urgente: 'tYES' });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user