bitovi/canjs — pull request #1114 by asavoy (2014-06-25 08:23:44+00:00)
Title: Sorting a List doesn't update in a template correctly

I'm trying to use `.comparator` and `.sort()` as described in [can.Map.prototype.sort](http://canjs.com/docs/can.List.prototype.sort.html) to change the sorting of a can.List that is bound in a Mustache template.

The can.List gets correctly sorted, but there appear to be a few bugs that prevent the template from reflecting the sorted data correctly.

Please refer to this [JSFiddle](http://jsfiddle.net/qYdwR/1627/):

* Calling `list.sort()` won't update the rendered template at all.
* But calling `can.trigger(list, 'length')` or `list.push(newItem)` WILL force the update, but only for `{{#key}}...{{/key}}` syntax. It's not the worst workaround, but I prefer to use `{{#each}}` because that provides `{{@index}}`.
* The `{{#each}}` syntax will never show list sorted, even after adding items to it.

* (Another weird thing is, in this case, adding an item will render the new item twice.)

I've added tests that cover all of these issues.