Always destroy misspelling markers

This commit is contained in:
Corey Johnson & Kevin Sawicki
2013-03-05 09:24:41 -08:00
parent 1c09a1352b
commit 8c1ec19797
2 changed files with 21 additions and 0 deletions

View File

@@ -39,6 +39,11 @@ class MisspellingView extends View
getScreenRange: ->
new Range(@startPosition, @endPosition)
unsubscribe: ->
super
@editSession.destroyMarker(@marker)
containsCursor: ->
cursor = @editor.getCursorScreenPosition()
@getScreenRange().containsPoint(cursor, exclusive: false)

View File

@@ -96,3 +96,19 @@ describe "Spell check", ->
expect(editor.find('.corrections').length).toBe 1
expect(editor.find('.corrections li').length).toBe 0
expect(editor.find('.corrections .error').text()).toBe "No corrections found"
describe "when the edit session is destroyed", ->
it "destroys all misspelling markers", ->
editor.setText("mispelling")
config.set('spell-check.grammars', ['source.js'])
waitsFor ->
editor.find('.misspelling').length > 0
runs ->
expect(editor.find('.misspelling').length).toBe 1
view = editor.find('.misspelling').view()
buffer = editor.getBuffer()
expect(buffer.getMarkerPosition(view.marker)).not.toBeUndefined()
editor.destroyEditSessions()
expect(buffer.getMarkerPosition(view.marker)).toBeUndefined()