mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
[Gutter] Add comment to explain avoided decoration update in presenter & remove test
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user