mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Always destroy misspelling markers
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user