[Gutter] Don't allow the 'line-number' gutter to be destroyed

This commit is contained in:
Jess Lin
2015-03-30 14:49:35 -07:00
parent 94a0bf3f90
commit a6efa104db
2 changed files with 10 additions and 3 deletions

View File

@@ -62,3 +62,7 @@ describe 'Gutter', ->
didDestroy = true
gutter.destroy()
expect(didDestroy).toBe true
it 'does not allow destroying the line-number gutter', ->
gutter = new Gutter mockGutterContainer, {name: 'line-number'}
expect(gutter.destroy).toThrow()

View File

@@ -23,9 +23,12 @@ class Gutter
@emitter = new Emitter
destroy: ->
@gutterContainer.removeGutter(this)
@emitter.emit 'did-destroy'
@emitter.dispose()
if @name is 'line-number'
throw new Error('The line-number gutter cannot be destroyed.')
else
@gutterContainer.removeGutter(this)
@emitter.emit 'did-destroy'
@emitter.dispose()
hide: ->
if @visible