Handle changing ::lineHeight in TextEditorPresenter
Esse commit está contido em:
@@ -157,3 +157,43 @@ describe "TextEditorPresenter", ->
|
||||
tokens: line4.tokens
|
||||
top: 10 * 4
|
||||
}
|
||||
|
||||
describe "when ::lineHeight changes", ->
|
||||
it "updates the lines that are visible on screen", ->
|
||||
presenter = new TextEditorPresenter(model: editor, clientHeight: 15, scrollTop: 10, lineHeight: 10, lineOverdrawMargin: 0)
|
||||
|
||||
line1 = editor.tokenizedLineForScreenRow(1)
|
||||
line2 = editor.tokenizedLineForScreenRow(2)
|
||||
line3 = editor.tokenizedLineForScreenRow(3)
|
||||
line4 = editor.tokenizedLineForScreenRow(4)
|
||||
line5 = editor.tokenizedLineForScreenRow(5)
|
||||
|
||||
expect(presenter.state.lines[line1.id]).toBeDefined()
|
||||
expect(presenter.state.lines[line2.id]).toBeDefined()
|
||||
expect(presenter.state.lines[line3.id]).toBeUndefined()
|
||||
expect(presenter.state.lines[line4.id]).toBeUndefined()
|
||||
expect(presenter.state.lines[line5.id]).toBeUndefined()
|
||||
|
||||
presenter.setLineHeight(5)
|
||||
|
||||
expect(presenter.state.lines[line1.id]).toBeUndefined()
|
||||
|
||||
expectValues presenter.state.lines[line2.id], {
|
||||
screenRow: 2
|
||||
tokens: line2.tokens
|
||||
top: 5 * 2
|
||||
}
|
||||
|
||||
expectValues presenter.state.lines[line3.id], {
|
||||
screenRow: 3
|
||||
tokens: line3.tokens
|
||||
top: 5 * 3
|
||||
}
|
||||
|
||||
expectValues presenter.state.lines[line4.id], {
|
||||
screenRow: 4
|
||||
tokens: line4.tokens
|
||||
top: 5 * 4
|
||||
}
|
||||
|
||||
expect(presenter.state.lines[line5.id]).toBeUndefined()
|
||||
|
||||
@@ -51,3 +51,6 @@ class TextEditorPresenter
|
||||
|
||||
setClientHeight: (@clientHeight) ->
|
||||
@updateLinesState()
|
||||
|
||||
setLineHeight: (@lineHeight) ->
|
||||
@updateLinesState()
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário