Add .right and .bottom to presenter scrollbar states

This commit is contained in:
Nathan Sobo
2015-01-28 18:54:50 -07:00
parent 14776e3f0a
commit 0910e86357
2 changed files with 42 additions and 7 deletions

View File

@@ -111,6 +111,22 @@ describe "TextEditorPresenter", ->
expectStateUpdate presenter, -> presenter.setHorizontalScrollbarHeight(20)
expect(presenter.state.horizontalScrollbar.height).toBe 20
describe ".right", ->
it "is ::verticalScrollbarWidth if the vertical scrollbar is visible and 0 otherwise", ->
presenter = new TextEditorPresenter
model: editor
height: editor.getLineCount() * 10 + 50
contentFrameWidth: editor.getMaxScreenLineLength() * 10
baseCharacterWidth: 10
lineHeight: 10
horizontalScrollbarHeight: 10
verticalScrollbarWidth: 10
{state} = presenter
expect(state.horizontalScrollbar.right).toBe 0
presenter.setHeight((editor.getLineCount() * 10) - 1)
expect(state.horizontalScrollbar.right).toBe 10
describe ".verticalScrollbar", ->
describe ".visible", ->
it "is true if the scrollHeight exceeds the computed client height", ->
@@ -145,6 +161,22 @@ describe "TextEditorPresenter", ->
expectStateUpdate presenter, -> presenter.setVerticalScrollbarWidth(20)
expect(presenter.state.verticalScrollbar.width).toBe 20
describe ".bottom", ->
it "is ::horizontalScrollbarHeight if the horizontal scrollbar is visible and 0 otherwise", ->
presenter = new TextEditorPresenter
model: editor
height: editor.getLineCount() * 10 - 1
contentFrameWidth: editor.getMaxScreenLineLength() * 10 + 50
baseCharacterWidth: 10
lineHeight: 10
horizontalScrollbarHeight: 10
verticalScrollbarWidth: 10
{state} = presenter
expect(state.verticalScrollbar.bottom).toBe 0
presenter.setContentFrameWidth(editor.getMaxScreenLineLength() * 10)
expect(state.verticalScrollbar.bottom).toBe 10
describe ".content", ->
describe ".scrollWidth", ->
it "is initialized as the max of the ::contentFrameWidth and the width of the longest line", ->