diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 12f353814..d744face1 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -128,6 +128,16 @@ describe "TextEditorPresenter", -> expectStateUpdate presenter, -> editor.setSoftWrapped(false) expect(presenter.state.horizontalScrollbar.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + it "updates when the longest line changes", -> + presenter = new TextEditorPresenter(model: editor, contentFrameWidth: 50, baseCharacterWidth: 10) + + expect(presenter.state.horizontalScrollbar.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + + expectStateUpdate presenter, -> editor.setCursorBufferPosition([editor.getLongestScreenRow(), 0]) + expectStateUpdate presenter, -> editor.insertText('xyz') + + expect(presenter.state.horizontalScrollbar.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + describe ".scrollLeft", -> it "tracks the value of ::scrollLeft", -> presenter = new TextEditorPresenter(model: editor, scrollLeft: 10, lineHeight: 10, lineOverdrawMargin: 1) @@ -298,6 +308,16 @@ describe "TextEditorPresenter", -> expectStateUpdate presenter, -> editor.setSoftWrapped(false) expect(presenter.state.content.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + it "updates when the longest line changes", -> + presenter = new TextEditorPresenter(model: editor, contentFrameWidth: 50, baseCharacterWidth: 10) + + expect(presenter.state.content.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + + expectStateUpdate presenter, -> editor.setCursorBufferPosition([editor.getLongestScreenRow(), 0]) + expectStateUpdate presenter, -> editor.insertText('xyz') + + expect(presenter.state.content.scrollWidth).toBe 10 * editor.getMaxScreenLineLength() + 1 + describe ".scrollTop", -> it "tracks the value of ::scrollTop", -> presenter = new TextEditorPresenter(model: editor, scrollTop: 10, lineHeight: 10)