Search code examples
ember.jsqunitember-testing

How to write a failing test with ember to show pushObject is required (instead of just push)?


I'm looking for a way to prove that pushObject is required (to push changes up as events fire).

What is the smallest/simplest qunit test to show this in action? ie- does it require a item inside the array has a computed property or is it enough to modify the array (and have that array bound to an hbs template) ?

no jsfiddle is required here just looking for a conceptual "how can I prove this"


Solution

  • Are you looking for a way to show that pushObject() works with observers, but modifying the array in other (non-Ember friendly) ways doesn't work? If so, I think this JSBin shows that. It seems as if a simple array bound to a Handlebars template is enough to show that push() doesn't work, but pushObject() does.