Fix test after carousel controller changes.

This commit is contained in:
Dermot Duffy
2023-09-05 20:47:08 -07:00
parent 1a4d38e609
commit 7173743d0b
@@ -130,10 +130,7 @@ describe('CarouselController', () => {
expect(settleHandler).toBeCalled(); expect(settleHandler).toBeCalled();
}); });
describe('should dispatch select event on', () => { it('should dispatch select event', () => {
it.each([['init' as const], ['select' as const]])(
'%s',
(emblaApiEvt: 'init' | 'select') => {
const children = createTestSlideNodes(); const children = createTestSlideNodes();
const parent = createParent({ children: children }); const parent = createParent({ children: children });
new CarouselController(createRoot(), parent); new CarouselController(createRoot(), parent);
@@ -143,7 +140,7 @@ describe('CarouselController', () => {
getEmblaApi()?.selectedScrollSnap.mockReturnValue(6); getEmblaApi()?.selectedScrollSnap.mockReturnValue(6);
getEmblaApi()?.slideNodes.mockReturnValue(children); getEmblaApi()?.slideNodes.mockReturnValue(children);
callEmblaHandler(getEmblaApi(), emblaApiEvt); callEmblaHandler(getEmblaApi(), 'select');
expect(selectHandler).toBeCalledWith( expect(selectHandler).toBeCalledWith(
expect.objectContaining({ expect.objectContaining({
@@ -153,8 +150,6 @@ describe('CarouselController', () => {
}, },
}), }),
); );
},
);
}); });
it('should not dispatch anything with an invalid scroll snap', () => { it('should not dispatch anything with an invalid scroll snap', () => {