Skip to content

Commit

Permalink
test: fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Jun 13, 2024
1 parent 995a836 commit 6f5b322
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions tests/scrollWidth.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,35 @@ describe('List.scrollWidth', () => {
let mockMouseEvent;
let pageX: number;

const holderHeight = 100;
let holderWidth = 100;

beforeAll(() => {
mockElement = spyElementPrototypes(HTMLElement, {
offsetHeight: {
get: () => ITEM_HEIGHT,
get() {
if (this.classList.contains('rc-virtual-list-holder')) {
return holderHeight;
}
return ITEM_HEIGHT;
},
},
offsetWidth: {
get() {
return holderWidth;
},
},
clientHeight: {
get: () => holderWidth,
get() {
return holderWidth;
},
},
getBoundingClientRect() {
return {
width: holderWidth,
height: holderHeight,
};
},
getBoundingClientRect: () => ({
width: holderWidth,
height: 100,
}),
});

mockMouseEvent = spyElementPrototypes(MouseEvent, {
Expand Down

0 comments on commit 6f5b322

Please sign in to comment.