feat(carousel): update test description and improve item selection logic in carousel component
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user