diff --git a/src/app/shared/components/carousel/carousel.component.spec.ts b/src/app/shared/components/carousel/carousel.component.spec.ts index 48e6098..c8b2c46 100644 --- a/src/app/shared/components/carousel/carousel.component.spec.ts +++ b/src/app/shared/components/carousel/carousel.component.spec.ts @@ -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; diff --git a/src/app/shared/components/carousel/carousel.component.ts b/src/app/shared/components/carousel/carousel.component.ts index ed42be5..f387335 100644 --- a/src/app/shared/components/carousel/carousel.component.ts +++ b/src/app/shared/components/carousel/carousel.component.ts @@ -137,7 +137,9 @@ export class CarouselComponent implements AfterViewInit { return; } - const item = this.viewport().nativeElement.children.item(index) as HTMLElement | null; + const item = this.viewport() + .nativeElement.querySelectorAll('.carousel__item') + .item(index); item?.scrollIntoView({ behavior: 'smooth',