I feel like I’m trying to do something really simple (test a computed property), but just having the computed property in the components breaks all my tests.
The unit test:
import {
moduleForComponent,
test
} from 'ember-qunit';
import Ember from 'ember';
moduleForComponent('test-component', {});
test("It can solve the step", function(assert){
assert.expect(1);
var component = this.subject();
this.render();
Ember.run(function(){
component.set("propertyBeingObserved", "Some value");
});
assert.equal(component.get("computedProperty"), "Some value observed");
});
And the component:
import Ember from 'ember';
export default Ember.Component.extend({
computedProperty: Ember.computed("propertyBeingObserved", function(){
return this.get("propertyBeingObserved") + " observed";
})
});
Depending on which variation of this code I try, I get errors ranging from needing to use Ember.set()
to one telling me that I can’t have more than one root element. Sometimes it’ll even break tests in different modules. This seems pretty 101- what am I screwing up?