 
 test 'observer updates when multiple pushed at once', ->
   Ember.run -> nums.pushObjects([8,10])
-  equal observer.get('arrayDidChangeCount'),2
+  equal observer.get('arrayDidChangeCount'),1
 
 
 test 'make FilteredArray on the fly', ->

    # do nothing

  arrayDidChange: (observedObj, start, removeCount, addCount) ->
    for i in [start...(start+addCount)]
      obj = observedObj[i]
      if @get('parent').filterFunc(obj,i)
        @get('parent').pushObject(obj)


FilteredArray = Ember.Object.extend Ember.MutableArray,
  init: (ops) ->
    @get('all').addArrayObserver(FilteredObserver.create(parent: this))

  "[]": (->
    c = []
    i = 0
    for num in @get('all')
      if @filterFunc(num,i)
        c.push(num)
      i += 1
    Ember.A(c)).property()

  replace: (i,thing,objects) ->
    for obj in objects
      @get('[]').pushObject(obj)
      @arrayContentDidChange(@get('[].length')-1,0,1)

  objectAt: (i) ->
    @get('[]').objectAt(i)

  lengthBinding: "[].length"


  equal observer.get('arrayDidChangeCount'),1
  equalArray even,[3,4,5,8]

test 'forEach up to date after removal', ->
  Ember.run -> nums.removeAt(1)
  equalArray even,[4]

test 'forEach up to date after removal of odd', ->
  Ember.run -> nums.removeAt(2)
  equalArray even,[2,4]

test 'forEach up to date after removal of 4', ->
  Ember.run -> nums.removeAt(3)
  equalArray even,[2]


PagedArray = Ember.Object.extend
