Skip to content

Commit

Permalink
add rtl test
Browse files Browse the repository at this point in the history
  • Loading branch information
yoyo837 committed Dec 15, 2023
1 parent 22effd4 commit 0e78a00
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/scroll.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,45 @@ describe('List.Scroll', () => {
});
});

describe('scrollbar rtl', () => {
it('moving', () => {
const listRef = React.createRef();
const wrapper = genList({
itemHeight: 20,
height: 100,
data: genData(100),
ref: listRef,
direction: 'rtl',
});

// Mouse down
wrapper.find('.rc-virtual-list-scrollbar-thumb').simulate('mousedown', {
pageY: 0,
});

// Mouse move
act(() => {
const mouseMoveEvent = new Event('mousemove');
mouseMoveEvent.pageY = 10;
window.dispatchEvent(mouseMoveEvent);
});

expect(wrapper.find('.rc-virtual-list-holder').props().style.pointerEvents).toEqual('none');

act(() => {
jest.runAllTimers();
});

// Mouse up
act(() => {
const mouseUpEvent = new Event('mouseup');
window.dispatchEvent(mouseUpEvent);
});

expect(wrapper.find('ul').instance().scrollTop > 10).toBeTruthy();
});
});

it('no bubble', () => {
const wrapper = genList({ itemHeight: 20, height: 100, data: genData(100) });

Expand Down

0 comments on commit 0e78a00

Please sign in to comment.