Skip to content

Commit db5993b

Browse files
committed
feat(RTL): Update to new carousel classes
1 parent bd6dcf7 commit db5993b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Carousel.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ export interface CarouselProps
4646
activeIndex?: number;
4747
onSelect?: (eventKey: number, event: Record<string, unknown> | null) => void;
4848
defaultActiveIndex?: number;
49-
onSlide?: (eventKey: number, direction: 'left' | 'right') => void;
50-
onSlid?: (eventKey: number, direction: 'left' | 'right') => void;
49+
onSlide?: (eventKey: number, direction: 'start' | 'end') => void;
50+
onSlid?: (eventKey: number, direction: 'start' | 'end') => void;
5151
interval?: number | null;
5252
keyboard?: boolean;
5353
pause?: 'hover' | false;
@@ -352,7 +352,7 @@ function CarouselFunc(uncontrolledProps: CarouselProps, ref) {
352352
}
353353
});
354354

355-
const slideDirection = direction === 'next' ? 'left' : 'right';
355+
const slideDirection = direction === 'next' ? 'start' : 'end';
356356

357357
useUpdateEffect(() => {
358358
if (slide) {

test/CarouselSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('<Carousel>', () => {
108108
it(`should call ${eventName} with previous index and direction`, (done) => {
109109
function onEvent(index, direction) {
110110
expect(index).to.equal(0);
111-
expect(direction).to.equal('right');
111+
expect(direction).to.equal('end');
112112

113113
done();
114114
}
@@ -130,7 +130,7 @@ describe('<Carousel>', () => {
130130
function onEvent(index, direction) {
131131
const lastPossibleIndex = items.length - 1;
132132
expect(index).to.equal(lastPossibleIndex);
133-
expect(direction).to.equal('left');
133+
expect(direction).to.equal('start');
134134

135135
done();
136136
}

0 commit comments

Comments
 (0)