Skip to content

Instantly share code, notes, and snippets.

@ppcano
Created December 19, 2012 08:50
Show Gist options
  • Select an option

  • Save ppcano/4335372 to your computer and use it in GitHub Desktop.

Select an option

Save ppcano/4335372 to your computer and use it in GitHub Desktop.
test("if a containerView appends a child in its didInsertElement event, the didInsertElement event of the child view should be fired once", function () {
var counter = 0,
root = Ember.ContainerView.create({});
var container = Ember.ContainerView.create({
didInsertElement: function() {
var view = Ember.ContainerView.create({
didInsertElement: function() {
counter++;
}
});
this.get('childViews').pushObject(view);
}
});
Ember.run(function() {
root.appendTo('#qunit-fixture');
});
Ember.run(function() {
root.get('childViews').pushObject(container);
});
equal(container.get('childViews').get('length'), 1 , "containerView should only have a child");
equal(counter, 1 , "didInsertElement should be fired once");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment