Created
September 18, 2010 21:32
-
-
Save frekw/586055 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
module("SC.TreeController - binding_bug", {}); | |
test("observing a bound property in a treecontroller and using it to set its own 'content' property shouldn't cause an infinite loop", function(){ | |
NameSpace = {}; | |
NameSpace.a = SC.ArrayController.create({}); | |
NameSpace.b = SC.TreeController.create({ | |
counter: 0, | |
bar: null, | |
barBinding: 'NameSpace.a.content', | |
content: null, | |
test: function(){ | |
var value = this.get('counter'); | |
var bar = this.get('bar'); | |
value++; | |
this.set('counter', value); | |
this.set('content', bar); // this is what causes the failure. | |
}.observes('bar') | |
}); | |
NameSpace.a.set('content', [1, 2]); | |
SC.Binding.flushPendingChanges(); | |
equals(1, NameSpace.b.get('counter')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment