fix(grid): restore scroll after transpose
This commit is contained in:
1 parent
ceadf73e4b
commit
e3350e2ec4
3 files changed
+35
-3
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { dataGridBottomScrollTop, isDataGridAtScrollBottom } from "@/lib/dataGrid/dataGridInfiniteScroll";
|
||||
import { dataGridBottomScrollTop, isDataGridAtScrollBottom, restoredDataGridScrollLeft } from "@/lib/dataGrid/dataGridInfiniteScroll";
|
||||
|
||||
describe("data grid bottom anchoring", () => {
|
||||
it("keeps DOM rows anchored when scrollbar padding increases the scroll height", () => {
|
||||
@@ -30,3 +30,17 @@ describe("data grid bottom anchoring", () => {
|
||||
expect(isDataGridAtScrollBottom({ scrollTop: 700, scrollHeight: 1000, clientHeight: 260 })).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("data grid horizontal restoration", () => {
|
||||
it("restores the previous horizontal position after the grid remounts", () => {
|
||||
expect(restoredDataGridScrollLeft(320, 1200, 600)).toBe(320);
|
||||
});
|
||||
|
||||
it("clamps the previous position when the scrollable width shrinks", () => {
|
||||
expect(restoredDataGridScrollLeft(720, 1000, 600)).toBe(400);
|
||||
});
|
||||
|
||||
it("resets the position when the rebuilt grid no longer overflows", () => {
|
||||
expect(restoredDataGridScrollLeft(320, 500, 600)).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user