First Release of Claw3D (#11)
Co-authored-by: iamlukethedev <iamlukethedev@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { isNearBottom } from "@/lib/dom";
|
||||
|
||||
describe("isNearBottom", () => {
|
||||
it("returns true when within the threshold of the bottom", () => {
|
||||
expect(
|
||||
isNearBottom({ scrollTop: 560, clientHeight: 400, scrollHeight: 1000 }, 40)
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when above the threshold", () => {
|
||||
expect(
|
||||
isNearBottom({ scrollTop: 500, clientHeight: 400, scrollHeight: 1000 }, 40)
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("treats negative remaining distance as near bottom", () => {
|
||||
expect(
|
||||
isNearBottom({ scrollTop: 700, clientHeight: 400, scrollHeight: 1000 }, 40)
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user