test on empty task-text entry, for #330

This commit is contained in:
Tyler Renelle
2013-02-11 13:12:15 -05:00
parent edee8d2719
commit 031b4029c6
2 changed files with 11 additions and 11 deletions
+4 -2
View File
@@ -43,8 +43,10 @@ module.exports.app = (appExports, model) ->
list = model.at "_#{type}List"
newModel = model.at('_new' + type.charAt(0).toUpperCase() + type.slice(1))
text = newModel.get()
# Don't add a blank todo
return if /^(\s)*$/.test(text)
# Don't add a blank task
if /^(\s)*$/.test(text)
console.error "Task text entered was an empty string."
return
newModel.set ''
switch type