💚 Fix LinesYardstick specs

This commit is contained in:
Antonio Scandurra
2015-12-04 12:54:20 +01:00
parent 16525047f1
commit 14d8ecefdd
2 changed files with 5 additions and 1 deletions

View File

@@ -57,7 +57,10 @@ describe "LinesYardstick", ->
textNodes
editor.setLineHeightInPixels(14)
linesYardstick = new LinesYardstick(editor, mockPresenter, mockLineNodesProvider, new LineTopIndex(), atom.grammars)
lineTopIndex = new LineTopIndex()
lineTopIndex.setDefaultLineHeight(editor.getLineHeightInPixels())
lineTopIndex.setMaxRow(editor.getScreenLineCount())
linesYardstick = new LinesYardstick(editor, mockPresenter, mockLineNodesProvider, lineTopIndex, atom.grammars)
afterEach ->
lineNode.remove() for lineNode in createdLineNodes

View File

@@ -25,6 +25,7 @@ class LinesYardstick
row = @lineTopIndex.rowForTopPixelPosition(targetTop, 'floor')
targetLeft = 0 if targetTop < 0
targetLeft = Infinity if row > @model.getLastScreenRow()
row = Math.min(row, @model.getLastScreenRow())
@prepareScreenRowsForMeasurement([row]) unless measureVisibleLinesOnly