emberjs/ember.js — pull request #1537 by crofty (2012-11-13 17:27:50+00:00)
Title: Bug in SortableMixin

There is a bug in the SortableMixin, there is a failing test that demonstrates it below.

What I *think* is happening is, when an item is removed from the `content` property of an ArrayProxy, it mirrors this change in the `arrangedContent` property by calling `arrangedContent.removeObject(item)`. This, in turn, attempts to mirror the change in the `content` property and it this is cyclical until there are no items remaining.

This test fails as all items are removed from the array proxy, the expected result is that only one item is removed.

```.js
test("removing the last item of a sorted array proxy only removes last item", function() {
var sortedArrayProxy = Ember.ArrayProxy.create(Ember.SortableMixin,{
sortProperties: ['id'],
sortAscending: false,
content: Ember.A([{id: 1}, {id: 2}])
});
equal( sortedArrayProxy.get('length'), 2, 'precond - array has 2 items');
sortedArrayProxy.removeObject(sortedArrayProxy.get('lastObject'));
equal( sortedArrayProxy.get('length'), 1, 'array has 1 item');
});
```