Created
December 19, 2012 08:50
-
-
Save ppcano/4335372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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