Skip to content

Instantly share code, notes, and snippets.

@bsideup
Created June 3, 2013 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bsideup/5698639 to your computer and use it in GitHub Desktop.
Save bsideup/5698639 to your computer and use it in GitHub Desktop.
package ;
import haxe.unit.TestCase;
import bindx.IBindable;
using bindx.Bind;
/**
* ...
* @author deep <system.grand@gmail.com>
*/
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