From b42cc6f683bc0ef6a0c26d21997c6581e841090d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 13 Jun 2013 17:12:23 -0700 Subject: [PATCH] Update spell check view to use new task --- spec/stdlib/task-spec.coffee | 8 ++++---- src/packages/spell-check/lib/spell-check-view.coffee | 7 ++++--- src/packages/spell-check/spec/spell-check-spec.coffee | 2 +- src/stdlib/task.coffee | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/spec/stdlib/task-spec.coffee b/spec/stdlib/task-spec.coffee index 8e54a8040..2fc5242e3 100644 --- a/spec/stdlib/task-spec.coffee +++ b/spec/stdlib/task-spec.coffee @@ -1,12 +1,12 @@ Task = require 'task' -fdescribe "Task", -> +describe "Task", -> describe "populating the window with fake properties", -> describe "when jQuery is loaded in a child process", -> it "doesn't log to the console", -> - spyOn(console, 'log').andCallThrough() - spyOn(console, 'error').andCallThrough() - spyOn(console, 'warn').andCallThrough() + spyOn(console, 'log') + spyOn(console, 'error') + spyOn(console, 'warn') jqueryTask = new Task('fixtures/jquery-task-handler.coffee') jqueryLoaded = false diff --git a/src/packages/spell-check/lib/spell-check-view.coffee b/src/packages/spell-check/lib/spell-check-view.coffee index c5471b1a9..5b0292e97 100644 --- a/src/packages/spell-check/lib/spell-check-view.coffee +++ b/src/packages/spell-check/lib/spell-check-view.coffee @@ -1,6 +1,6 @@ {View} = require 'space-pen' _ = require 'underscore' -SpellCheckTask = require './spell-check-task' +Task = require 'task' MisspellingView = require './misspelling-view' module.exports = @@ -8,6 +8,7 @@ class SpellCheckView extends View @content: -> @div class: 'spell-check' + task: null views: [] initialize: (@editor) -> @@ -21,10 +22,10 @@ class SpellCheckView extends View beforeRemove: -> @unsubscribeFromBuffer() + @task?.terminate unsubscribeFromBuffer: -> @destroyViews() - @task?.abort() if @buffer? @buffer.off 'contents-modified', @updateMisspellings @@ -54,6 +55,6 @@ class SpellCheckView extends View @append(view) updateMisspellings: => - @task.start buffer.getText(), (misspellings) => + @task.start @buffer.getText(), (misspellings) => @destroyViews() @addViews(misspellings) diff --git a/src/packages/spell-check/spec/spell-check-spec.coffee b/src/packages/spell-check/spec/spell-check-spec.coffee index 1c754c64f..7ce61f108 100644 --- a/src/packages/spell-check/spec/spell-check-spec.coffee +++ b/src/packages/spell-check/spec/spell-check-spec.coffee @@ -1,6 +1,6 @@ RootView = require 'root-view' -fdescribe "Spell check", -> +describe "Spell check", -> [editor] = [] beforeEach -> diff --git a/src/stdlib/task.coffee b/src/stdlib/task.coffee index 1bbc7e41a..24630ae69 100644 --- a/src/stdlib/task.coffee +++ b/src/stdlib/task.coffee @@ -43,4 +43,4 @@ class Task @off() -_.extend Task.prototype, EventEmitter \ No newline at end of file +_.extend Task.prototype, EventEmitter