mirror of
https://github.com/atom/atom.git
synced 2026-02-10 06:35:00 -05:00
Finish integrating LineTopIndex
This commit is contained in:
@@ -1664,7 +1664,7 @@ describe('TextEditorComponent', function () {
|
||||
})
|
||||
|
||||
it("renders visible and yet-to-be-measured block decorations, inserting them between the appropriate lines and refreshing them as needed", async function () {
|
||||
wrapperNode.style.height = 13 * lineHeightInPixels + 'px'
|
||||
wrapperNode.style.height = 9 * lineHeightInPixels + 'px'
|
||||
component.measureDimensions()
|
||||
await nextViewUpdatePromise()
|
||||
|
||||
@@ -1706,7 +1706,7 @@ describe('TextEditorComponent', function () {
|
||||
|
||||
await nextAnimationFramePromise()
|
||||
|
||||
expect(component.getDomNode().querySelectorAll(".line").length).toBe(9)
|
||||
expect(component.getDomNode().querySelectorAll(".line").length).toBe(7)
|
||||
|
||||
expect(component.tileNodesForLines()[0].style.height).toBe(TILE_SIZE * editor.getLineHeightInPixels() + "px")
|
||||
expect(component.tileNodesForLines()[0].style.webkitTransform).toBe("translate3d(0px, 0px, 0px)")
|
||||
@@ -1731,7 +1731,7 @@ describe('TextEditorComponent', function () {
|
||||
await nextAnimationFramePromise() // causes the DOM to update and to retrieve new styles
|
||||
await nextAnimationFramePromise() // applies the changes
|
||||
|
||||
expect(component.getDomNode().querySelectorAll(".line").length).toBe(9)
|
||||
expect(component.getDomNode().querySelectorAll(".line").length).toBe(7)
|
||||
|
||||
expect(component.tileNodesForLines()[0].style.height).toBe(TILE_SIZE * editor.getLineHeightInPixels() + "px")
|
||||
expect(component.tileNodesForLines()[0].style.webkitTransform).toBe("translate3d(0px, 0px, 0px)")
|
||||
@@ -1765,10 +1765,11 @@ describe('TextEditorComponent', function () {
|
||||
expect(component.getTopmostDOMNode().querySelector(".decoration-1")).toBeNull()
|
||||
expect(component.getTopmostDOMNode().querySelector(".decoration-2")).toBe(item2)
|
||||
expect(component.getTopmostDOMNode().querySelector(".decoration-3")).toBe(item3)
|
||||
expect(component.getTopmostDOMNode().querySelector(".decoration-4")).toBeNull()
|
||||
expect(component.getTopmostDOMNode().querySelector(".decoration-4")).toBe(item4)
|
||||
|
||||
expect(item2.getBoundingClientRect().top).toBe(editor.getLineHeightInPixels() * 3)
|
||||
expect(item3.getBoundingClientRect().top).toBe(editor.getLineHeightInPixels() * 5 + 20)
|
||||
expect(item4.getBoundingClientRect().top).toBe(editor.getLineHeightInPixels() * 8 + 20 + 100)
|
||||
})
|
||||
|
||||
it("correctly sets screen rows on <content> elements, both initially and when decorations move", async function () {
|
||||
|
||||
@@ -2150,12 +2150,12 @@ describe "TextEditorPresenter", ->
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration2), {
|
||||
decoration: blockDecoration2
|
||||
screenRow: 4
|
||||
isVisible: false
|
||||
isVisible: true
|
||||
}
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration3), {
|
||||
decoration: blockDecoration3
|
||||
screenRow: 4
|
||||
isVisible: false
|
||||
isVisible: true
|
||||
}
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration4), {
|
||||
decoration: blockDecoration4
|
||||
@@ -2196,23 +2196,16 @@ describe "TextEditorPresenter", ->
|
||||
screenRow: 4
|
||||
isVisible: false
|
||||
}
|
||||
expect(stateForBlockDecoration(presenter, blockDecoration4)).toBeUndefined()
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration4), {
|
||||
decoration: blockDecoration4
|
||||
screenRow: 10
|
||||
isVisible: true
|
||||
}
|
||||
|
||||
presenter.invalidateBlockDecorationDimensions(blockDecoration1)
|
||||
presenter.setBlockDecorationDimensions(blockDecoration2, 0, 10)
|
||||
presenter.setBlockDecorationDimensions(blockDecoration3, 0, 10)
|
||||
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration1), {
|
||||
decoration: blockDecoration1
|
||||
screenRow: 0
|
||||
isVisible: false
|
||||
}
|
||||
expect(stateForBlockDecoration(presenter, blockDecoration2)).toBeUndefined()
|
||||
expect(stateForBlockDecoration(presenter, blockDecoration3)).toBeUndefined()
|
||||
expect(stateForBlockDecoration(presenter, blockDecoration4)).toBeUndefined()
|
||||
|
||||
presenter.setScrollTop(140)
|
||||
|
||||
expectValues stateForBlockDecoration(presenter, blockDecoration1), {
|
||||
decoration: blockDecoration1
|
||||
screenRow: 0
|
||||
@@ -2226,7 +2219,6 @@ describe "TextEditorPresenter", ->
|
||||
isVisible: true
|
||||
}
|
||||
|
||||
|
||||
describe ".overlays", ->
|
||||
[item] = []
|
||||
stateForOverlay = (presenter, decoration) ->
|
||||
@@ -3091,6 +3083,7 @@ describe "TextEditorPresenter", ->
|
||||
expectStateUpdate presenter, -> presenter.setLineHeight(Math.ceil(1.0 * explicitHeight / marker3.getBufferRange().end.row))
|
||||
|
||||
decorationState = getContentForGutterWithName(presenter, 'test-gutter')
|
||||
|
||||
expect(decorationState[decoration1.id].top).toBeDefined()
|
||||
expect(decorationState[decoration2.id].top).toBeDefined()
|
||||
expect(decorationState[decoration3.id].top).toBeDefined()
|
||||
|
||||
Reference in New Issue
Block a user