mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
test(diffs): model browser wheel modifiers and overflow axes
This commit is contained in:
+7
-1
@@ -48,6 +48,11 @@ function bindPoint(owner: CombinedDiffViewportOwner, key: string, offset: number
|
||||
}
|
||||
function wheel(target: HTMLElement, deltaY: number, init: WheelEventInit = {}): WheelEvent {
|
||||
const event = new WheelEvent('wheel', { bubbles: true, cancelable: true, deltaY, ...init })
|
||||
// Happy DOM's WheelEvent extends UIEvent, omitting browser mouse modifiers.
|
||||
Object.defineProperties(event, {
|
||||
ctrlKey: { value: init.ctrlKey ?? false },
|
||||
shiftKey: { value: init.shiftKey ?? false }
|
||||
})
|
||||
target.dispatchEvent(event)
|
||||
return event
|
||||
}
|
||||
@@ -176,7 +181,8 @@ it('yields to nested scrolling and containment, chaining outward only at an inne
|
||||
wheel(textarea, -7.5)
|
||||
expect(owner.getScrollTop()).toBe(112.5)
|
||||
const horizontal = document.createElement('div')
|
||||
horizontal.style.overflow = 'auto'
|
||||
horizontal.style.overflowX = 'auto'
|
||||
horizontal.style.overflowY = 'auto'
|
||||
Object.defineProperties(horizontal, {
|
||||
scrollWidth: { value: 500 },
|
||||
clientWidth: { value: 100 }
|
||||
|
||||
Reference in New Issue
Block a user