feat(carousel): update test description and improve item selection logic in carousel component

This commit is contained in:
2026-07-23 12:09:28 -03:00
parent a1d5ecb6fa
commit 8963bd5460
2 changed files with 4 additions and 3 deletions

View File

@@ -120,10 +120,9 @@ describe('CarouselComponent', () => {
expect(frame.style.width).toBe('632px');
});
it('vuelve al extremo opuesto cuando circular está habilitado', () => {
it('mantiene preparadas las páginas adyacentes y rota al terminar la transición', () => {
fixture.componentInstance.circular.set(true);
fixture.detectChanges();
expect(fixture.componentInstance.carousel().circular()).toBe(true);
const host = fixture.nativeElement.querySelector('app-carousel') as HTMLElement;
const firstItem = fixture.nativeElement.querySelector('.carousel__item') as HTMLElement;

View File

@@ -137,7 +137,9 @@ export class CarouselComponent<T> implements AfterViewInit {
return;
}
const item = this.viewport().nativeElement.children.item(index) as HTMLElement | null;
const item = this.viewport()
.nativeElement.querySelectorAll<HTMLElement>('.carousel__item')
.item(index);
item?.scrollIntoView({
behavior: 'smooth',