mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Add specs for updating scrollWidth when the longest line changes
This commit is contained in:
parent
b521e8dc97
commit
f005b2005f
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user