-
Notifications
You must be signed in to change notification settings - Fork 80
chore(deps): bump deps and update use-scroll-lock for jsdom 27.3+ CSSOM changes #242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,7 +237,16 @@ describe("useScrollLock", () => { | |
| it("should handle iOS specific behavior", () => { | ||
| (browser.isIOS as ReturnType<typeof vi.fn>).mockReturnValue(true); | ||
| const scrollY = 100; | ||
| Object.defineProperty(window, "scrollY", { value: scrollY }); | ||
| Object.defineProperty(window, "scrollY", { | ||
| value: scrollY, | ||
| configurable: true, | ||
| writable: true, | ||
| }); | ||
| Object.defineProperty(window, "scrollX", { | ||
| value: 0, | ||
| configurable: true, | ||
| writable: true, | ||
| }); | ||
|
|
||
| // Mock getComputedStyle with margins | ||
| window.getComputedStyle = vi.fn().mockReturnValue({ | ||
|
|
@@ -259,7 +268,11 @@ describe("useScrollLock", () => { | |
| expect(document.body.style.width).toBe( | ||
| `calc(100vw - ${scrollbarWidth + 20}px)`, | ||
| ); | ||
| expect(document.body.style.top).toBe(`-${scrollY}px`); | ||
| // Check data attributes since jsdom 27.3+ doesn't properly reflect top/left in style object | ||
| expect(document.body.getAttribute("data-scroll-lock-top")).toBe( | ||
| String(scrollY), | ||
| ); | ||
| expect(document.body.getAttribute("data-scroll-lock-left")).toBe("0"); | ||
|
Comment on lines
+271
to
+275
|
||
| expect(document.body.style.boxSizing).toBe("border-box"); | ||
| expect(document.body.style.overflow).toBe("hidden"); | ||
| }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the data attributes are helpful for testing, the code still attempts to set style.top and style.left (lines 213-214). If jsdom 27.3+ doesn't properly reflect these properties in the style object, these assignments may be ineffective in the test environment. Consider either:
The current approach maintains both mechanisms but it's not clear which one is authoritative.