fix(web): la columna de lotes y series va junto a la cantidad, a la vista

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GeorgeandClaude Sonnet 5.5 committed 2026-10-16 12:47:51 -05:00
1 parent fe8c080471
commit 08977741de
3 files changed
+51 -11

No files matched your search

@@ -580,3 +580,37 @@ describe('LinesGrid: detalles de línea (lotes)', () => {
expect(el.querySelector('sbo-line-detail-dialog footer .btn.main')).toBeNull();
});
});
describe('LinesGrid: dónde va la columna de lotes y series', () => {
@Component({
imports: [LinesGrid],
template: `<sbo-lines-grid [columns]="columns" [(lines)]="lines" [newLine]="newLine" [details]="details" />`,
})
class PlaceHost {
columns = [
{ key: 'ItemCode', title: 'Artículo' },
{ key: 'Quantity', title: 'Cantidad', type: 'number' as const },
{ key: 'Price', title: 'Precio', type: 'number' as const },
{ key: 'CostingCode', title: 'Dim. 1' },
];
lines = signal<readonly GridLine[]>([{ ItemCode: 'SU01', Quantity: 1, _manageBatches: true }]);
newLine = () => ({});
details = [{ key: 'BatchNumbers', title: 'Lotes', applies: () => true, columns: [], summary: () => 'Indicar lotes' }];
}
it('va justo después de la cantidad, no al final tras todas las demás columnas', async () => {
await TestBed.configureTestingModule({ imports: [PlaceHost], providers: [provideHttpClient(), provideHttpClientTesting()] }).compileComponents();
const fixture = TestBed.createComponent(PlaceHost);
fixture.detectChanges();
await fixture.whenStable();
fixture.detectChanges();
const el = fixture.nativeElement as HTMLElement;
const heads = [...el.querySelectorAll('thead th')].map((t) => t.textContent?.trim());
expect(heads.slice(1, 5)).toEqual(['Artículo', 'Cantidad', 'Lotes / Series', 'Precio']);
const cells = [...el.querySelectorAll('tbody tr:first-child td')];
expect(cells[3].classList.contains('det')).toBe(true);
expect(cells[3].textContent?.trim()).toBe('Indicar lotes');
// los índices de columna (teclado) no cuentan la columna de lotes
expect(el.querySelector('input[data-r="0"][data-c="2"]')).toBeTruthy();
});
});