Skip to content

Commit

Permalink
Fix editor save in Atom 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodalgaard committed Aug 21, 2017
1 parent 47fc7f4 commit defaa1b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
31 changes: 17 additions & 14 deletions spec/todo-show-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,27 @@ describe 'ShowTodo opening panes and executing commands', ->
runs ->
prevText = editor.getText()
editor.insertText 'TODO: This is an inserted todo'
editor.save()
expect(showTodoModule.showTodoView.isSearching()).toBe true

waitsFor -> showTodoModule.collection.getTodosCount() > 0
waitsForPromise -> editor.save()
runs ->
expect(showTodoModule.collection.getTodosCount()).toBe(nTodos + 1)
expect(showTodoModule.showTodoView.isSearching()).toBe true

executeCommand ->
editor.setText prevText
editor.save()
expect(showTodoModule.showTodoView).not.toBeDefined()
waitsFor -> showTodoModule.collection.getTodosCount() > 0
runs ->
expect(showTodoModule.collection.getTodosCount()).toBe(nTodos + 1)

dock.show()
editor.save()
waitsFor -> showTodoModule.collection.getTodosCount() > 0
runs ->
expect(showTodoModule.collection.getTodosCount()).toBe nTodos
executeCommand ->
editor.setText prevText
waitsForPromise -> editor.save()
runs ->
expect(showTodoModule.showTodoView).not.toBeDefined()
expect(showTodoModule.collection.getTodosCount()).toBe(nTodos + 1)

dock.show()
waitsForPromise -> editor.save()
runs ->
waitsFor -> showTodoModule.collection.getTodosCount() > 0
runs ->
expect(showTodoModule.collection.getTodosCount()).toBe nTodos

describe 'when todo item is clicked', ->
it 'opens the file', ->
Expand Down
16 changes: 8 additions & 8 deletions spec/todo-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ describe "Show Todo View", ->
runs ->
editor = atom.workspace.getActiveTextEditor()
editor.setText("# TODO: Test")
editor.save()

waitsFor -> !showTodoView.isSearching()
waitsForPromise -> editor.save()
runs ->
expect(showTodoView.getTodos()).toHaveLength 4
editor.setText("")
editor.save()

waitsFor -> !showTodoView.isSearching()
runs ->
expect(showTodoView.getTodos()).toHaveLength 3
expect(showTodoView.getTodos()).toHaveLength 4
editor.setText("")
waitsForPromise -> editor.save()
runs ->
waitsFor -> !showTodoView.isSearching()
runs ->
expect(showTodoView.getTodos()).toHaveLength 3

it "updates on search scope change", ->
expect(showTodoView.isSearching()).toBe false
Expand Down

0 comments on commit defaa1b

Please sign in to comment.