Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('useDroppableCollection', () => {
return this.getBoundingClientRect().top;
});

jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(function () {
jest.spyOn(HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function () {
return this.getBoundingClientRect().height;
});

Expand Down
8 changes: 4 additions & 4 deletions packages/@react-aria/selection/src/DOMLayoutDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export class DOMLayoutDelegate implements LayoutDelegate {
let itemRect = item.getBoundingClientRect();

return {
x: itemRect.left - containerRect.left + container.scrollLeft,
y: itemRect.top - containerRect.top + container.scrollTop,
x: itemRect.left - containerRect.left - container.clientLeft + container.scrollLeft,
y: itemRect.top - containerRect.top - container.clientTop + container.scrollTop,
width: itemRect.width,
height: itemRect.height
};
Expand All @@ -54,8 +54,8 @@ export class DOMLayoutDelegate implements LayoutDelegate {
return {
x: container?.scrollLeft ?? 0,
y: container?.scrollTop ?? 0,
width: container?.offsetWidth ?? 0,
height: container?.offsetHeight ?? 0
width: container?.clientWidth ?? 0,
height: container?.clientHeight ?? 0
};
}
}
6 changes: 3 additions & 3 deletions packages/react-aria-components/test/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1633,15 +1633,15 @@ describe('Table', () => {
});

describe('load more spinner', () => {
let offsetHeight, scrollHeight;
let clientHeight, scrollHeight;
let DndTable = stories.DndTable;
let initialItems = [
{id: '1', type: 'file', name: 'Adobe Photoshop'},
{id: '2', type: 'file', name: 'Adobe XD'}
];
beforeAll(function () {
scrollHeight = jest.spyOn(window.HTMLElement.prototype, 'scrollHeight', 'get').mockImplementation(() => 200);
offsetHeight = jest.spyOn(window.HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(function () {
clientHeight = jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(function () {
if (this.getAttribute('role') === 'grid') {
return 200;
}
Expand All @@ -1651,7 +1651,7 @@ describe('Table', () => {
});

afterAll(function () {
offsetHeight.mockReset();
clientHeight.mockReset();
scrollHeight.mockReset();
});

Expand Down
Loading