initial commit

This commit is contained in:
Dmitri Granetchi
2014-04-20 18:48:35 +03:00
commit f48651338b
14 changed files with 901 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
package ;
class TestProperty extends haxe.unit.TestCase {
public function new() {
super();
}
function test1() {
var p = new BindableProperty();
p.s = "1";
var callNum = 0;
p.sChanged.add(function (from, to) {
assertEquals(from, "1");
assertEquals(to, "");
callNum ++;
});
p.s = null;
p.sChanged.removeAll();
p.sChanged.add(function (from, to) {
assertEquals(from, "");
assertEquals(to, "1");
callNum ++;
});
p.s = "1";
assertEquals(callNum, 2);
}
}
class BindableProperty implements bindx.IBindable {
public function new() {
}
@:bindable
public var s(default, set):String;
function set_s(v) {
if (v == null) {
return s = "";
}
s = v;
return v;
}
}