Created
June 3, 2013 14:39
-
-
Save bsideup/5698639 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
package ; | |
import haxe.unit.TestCase; | |
import bindx.IBindable; | |
using bindx.Bind; | |
/** | |
* ... | |
* @author deep <[email protected]> | |
*/ | |
class TestBindx extends TestCase implements IBindable | |
{ | |
@bindable public var def:Int; | |
@bindable public function toString():String { | |
return '$def!'; | |
} | |
public function new() { | |
super(); | |
} | |
public function testBasic() { | |
var oldDef = this.def; | |
var newDef = 12; | |
var bindingDispatched = 0; | |
this.def.bind(function(oldValue, newValue) { | |
bindingDispatched++; | |
assertEquals(oldDef, oldValue); | |
assertEquals(newDef, newValue); | |
}); | |
this.def = newDef; | |
assertEquals(1, bindingDispatched); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment