[Gutter] Add comment to explain avoided decoration update in presenter & remove test

This commit is contained in:
Jess Lin
2015-04-20 22:59:03 -07:00
parent 9abd0232ce
commit 55c6a11c36
2 changed files with 3 additions and 13 deletions

View File

@@ -2468,19 +2468,6 @@ describe "TextEditorPresenter", ->
expect(decorationState[decoration3.id]).toBeUndefined()
expect(decorationState[decoration4.id].top).toBeDefined()
it "does not update when a gutter is destroyed (because it's unnecessary)", ->
gutter.destroy()
decorationState = decorationStateForGutterName(presenter, 'test-gutter')
expect(decorationState[decoration1.id].top).toBeDefined()
expect(decorationState[decoration2.id].top).toBeDefined()
expect(decorationState[decoration3.id]).toBeUndefined()
# However, the decoration state of the destroyed gutter should be
# cleared whenever ::updateCustomGutterDecorationState is next called.
expectStateUpdate presenter, -> editor.addGutter({name: 'a-different-gutter'})
decorationState = decorationStateForGutterName(presenter, 'test-gutter')
expect(decorationState).toBeUndefined()
it "updates when editor lines are folded", ->
oldDimensionsForDecoration1 =
top: lineHeight * marker1.getScreenRange().start.row

View File

@@ -401,6 +401,9 @@ class TextEditorPresenter
@disposables.remove(gutterDisposables)
gutterDisposables.dispose()
@updateCustomGutterState()
# It is not necessary to @updateCustomGutterDecorationState here.
# The destroyed gutter will be removed from the list of gutters in @state,
# and thus will be removed from the DOM.
@disposables.add(gutterDisposables)
@updateCustomGutterState()
@updateCustomGutterDecorationState()