fix: Fix thumbnail carousel scroll position (#1606)

* fix: Fix thumbnail carousel scroll position

* Small formatting fix
This commit is contained in:
Dermot Duffy
2024-10-02 20:28:13 -07:00
committed by GitHub
parent 1f5d4bd8b0
commit 21b468734c
7 changed files with 26 additions and 20 deletions
@@ -207,7 +207,7 @@ describe('CarouselController', () => {
loop: true,
containScroll: 'trimSnaps',
watchSlides: false,
watchResize: false,
watchResize: true,
watchDrag: false,
},
plugins,
@@ -59,10 +59,17 @@ describe('AutoSize', () => {
// First intersection handler call sets the state only.
callIntersectionHandler(true);
// When not visible, will not re-init.
callIntersectionHandler(false);
callIntersectionHandler(false);
callIntersectionHandler(false);
expect(emblaApi.reInit).not.toBeCalled();
// When visible, will re-initialize once.
callIntersectionHandler(true);
callIntersectionHandler(true);
expect(emblaApi.reInit).toBeCalledTimes(1);
});