Refactor task list tests and coffeescript

I refactored the Spinach tests and CoffeeScript for task lists to remove the repetition that @cirosantilli pointed out in #7964.