mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge branch 'lgeiger-patch-1'
This commit is contained in:
@@ -3846,6 +3846,40 @@ describe('TextEditorComponent', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the mousewheel event\'s target is an SVG element inside a block decoration', function () {
|
||||
it('keeps the block decoration on the DOM if it is scrolled off-screen', function () {
|
||||
wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px'
|
||||
wrapperNode.style.width = 20 * charWidth + 'px'
|
||||
editor.update({autoHeight: false})
|
||||
component.measureDimensions()
|
||||
runAnimationFrames()
|
||||
|
||||
const item = document.createElement('div')
|
||||
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg")
|
||||
item.appendChild(svgElement)
|
||||
editor.decorateMarker(
|
||||
editor.markScreenPosition([0, 0], {invalidate: "never"}),
|
||||
{type: "block", item: item}
|
||||
)
|
||||
|
||||
runAnimationFrames()
|
||||
|
||||
let wheelEvent = new WheelEvent('mousewheel', {
|
||||
wheelDeltaX: 0,
|
||||
wheelDeltaY: -500
|
||||
})
|
||||
Object.defineProperty(wheelEvent, 'target', {
|
||||
get: function () {
|
||||
return svgElement
|
||||
}
|
||||
})
|
||||
componentNode.dispatchEvent(wheelEvent)
|
||||
runAnimationFrames()
|
||||
|
||||
expect(component.getTopmostDOMNode().contains(item)).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('only prevents the default action of the mousewheel event if it actually lead to scrolling', function () {
|
||||
spyOn(WheelEvent.prototype, 'preventDefault').andCallThrough()
|
||||
wrapperNode.style.height = 4.5 * lineHeightInPixels + 'px'
|
||||
|
||||
@@ -909,7 +909,7 @@ class TextEditorComponent
|
||||
|
||||
screenRowForNode: (node) ->
|
||||
while node?
|
||||
if screenRow = node.dataset.screenRow
|
||||
if screenRow = node.dataset?.screenRow
|
||||
return parseInt(screenRow)
|
||||
node = node.parentElement
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user