Update tests to use editor.renderLines.css('top')

instead of editor.scrollView.scrollTop().
This commit is contained in:
Corey Johnson 2012-06-11 15:47:32 -07:00
parent e2bd646e0f
commit a4f4b3a3bb

View File

@ -295,21 +295,21 @@ describe "Editor", ->
it "restores scroll postion of edit session", -> it "restores scroll postion of edit session", ->
editor.attachToDom(heightInLines: 12) editor.attachToDom(heightInLines: 12)
buffer1 = editor.buffer buffer1 = editor.buffer
firstScrollTop = editor.scrollView.scrollTop() firstScrollTop = editor.scrollTop()
buffer2 = new Buffer(require.resolve('fixtures/two-hundred.txt')) buffer2 = new Buffer(require.resolve('fixtures/two-hundred.txt'))
editor.setBuffer(buffer2) editor.setBuffer(buffer2)
editor.moveCursorToBottom() editor.moveCursorToBottom()
secondScrollTop = editor.scrollView.scrollTop() secondScrollTop = editor.scrollTop()
expect(firstScrollTop).not.toEqual secondScrollTop expect(firstScrollTop).not.toEqual secondScrollTop
editor.loadNextEditSession() editor.loadNextEditSession()
expect(editor.buffer.path).toBe buffer1.path expect(editor.buffer.path).toBe buffer1.path
expect(editor.scrollView.scrollTop()).toBe firstScrollTop expect(editor.scrollTop()).toBe firstScrollTop
editor.loadNextEditSession() editor.loadNextEditSession()
expect(editor.buffer.path).toBe buffer2.path expect(editor.buffer.path).toBe buffer2.path
expect(editor.scrollView.scrollTop()).toBe secondScrollTop expect(editor.scrollTop()).toBe secondScrollTop
describe ".loadPreviousEditSession()", -> describe ".loadPreviousEditSession()", ->
it "loads the next editor state and wraps to beginning when end is reached", -> it "loads the next editor state and wraps to beginning when end is reached", ->
@ -332,19 +332,19 @@ describe "Editor", ->
beforeEach -> beforeEach ->
editor.attachToDom(heightInLines: 5) editor.attachToDom(heightInLines: 5)
expect(editor.verticalScrollbar.scrollTop()).toBe 0 expect(editor.verticalScrollbar.scrollTop()).toBe 0
expect(editor.renderedLines.css('-webkit-tranform')).toBeNull()
expect(editor.gutter.lineNumbers.css('-webkit-tranform')).toBeNull()
describe "when called with a scroll top argument", -> describe "when called with a scroll top argument", ->
it "sets the scrollTop of the vertical scrollbar and sets scrollTop on the line numbers and lines", -> it "sets the scrollTop of the vertical scrollbar and sets scrollTop on the line numbers and lines", ->
editor.scrollTop(100) editor.scrollTop(100)
expect(editor.verticalScrollbar.scrollTop()).toBe 100 expect(editor.verticalScrollbar.scrollTop()).toBe 100
expect(editor.scrollView.scrollTop()).toBe 100 expect(editor.scrollView.scrollTop()).toBe 0
expect(editor.renderedLines.css('top')).toBe "-100px"
expect(editor.gutter.scrollTop()).toBe 100 expect(editor.gutter.scrollTop()).toBe 100
editor.scrollTop(120) editor.scrollTop(120)
expect(editor.verticalScrollbar.scrollTop()).toBe 120 expect(editor.verticalScrollbar.scrollTop()).toBe 120
expect(editor.scrollView.scrollTop()).toBe 120 expect(editor.scrollView.scrollTop()).toBe 0
expect(editor.renderedLines.css('top')).toBe "-120px"
expect(editor.gutter.scrollTop()).toBe 120 expect(editor.gutter.scrollTop()).toBe 120
it "does not allow negative scrollTops to be assigned", -> it "does not allow negative scrollTops to be assigned", ->
@ -366,7 +366,7 @@ describe "Editor", ->
it "doesn't adjust the scrollTop of the vertical scrollbar", -> it "doesn't adjust the scrollTop of the vertical scrollbar", ->
editor.scrollTop(100, adjustVerticalScrollbar: false) editor.scrollTop(100, adjustVerticalScrollbar: false)
expect(editor.verticalScrollbar.scrollTop()).toBe 0 expect(editor.verticalScrollbar.scrollTop()).toBe 0
expect(editor.scrollView.scrollTop()).toBe 100 expect(editor.renderedLines.css('top')).toBe "-100px"
expect(editor.gutter.scrollTop()).toBe 100 expect(editor.gutter.scrollTop()).toBe 100
describe "when called with no argument", -> describe "when called with no argument", ->
@ -1059,7 +1059,7 @@ describe "Editor", ->
expect(editor.scrollTop()).toBe(editor.lineHeight) expect(editor.scrollTop()).toBe(editor.lineHeight)
editor.moveCursorUp() editor.moveCursorUp()
expect(editor.scrollView.scrollTop()).toBe(0) expect(editor.renderedLines.css('top')).toBe "0px"
describe "horizontal scrolling", -> describe "horizontal scrolling", ->
charWidth = null charWidth = null