chain bind WIP

This commit is contained in:
Dima Granetchi
2014-11-18 20:02:52 +02:00
parent 910f8f0d6f
commit 42aabddec3
5 changed files with 180 additions and 59 deletions
+55
View File
@@ -0,0 +1,55 @@
package ;
import bindx.Bind;
import bindx.BindxExt;
import bindx.IBindable;
import buddy.BuddySuite;
using buddy.Should;
//@exclude
class ChainBindTest extends BuddySuite {
public function new() {
describe("Using BindExt.chain", {
var b:BindableChain;
var callNum:Int;
before({
b = new BindableChain();
b.c = new BindableChain();
callNum = 0;
});
it("BindExt.chain should bind chain changes", {
b.c.f("tada").d = "a";
BindExt.chain(b.c.f("tada").d, function (_, _) callNum++);
b.c.f("tada").d = "b";
callNum.should.be(1);
});
});
}
}
class BindableChain implements bindx.IBindable {
@:bindable
public var d:String;
public var nd:String;
public var c:BindableChain;
@:bindable
public function f(s:String):BindableChain {
return c;
}
public function new() {
}
}
+21 -2
View File
@@ -1,6 +1,25 @@
package ;
import buddy.BuddySuite;
import buddy.SuitesRunner;
@:build(buddy.GenerateMain.build(null, ["test"]))
class Tests extends BuddySuite {}
class Tests extends BuddySuite {
public static function main() {
var reporter = new buddy.reporting.TravisHxReporter();
var runner = new SuitesRunner([
new BaseTest(),
new InheritanceTest(),
new InlineTest(),
new MetaTest(),
new SignalTest(),
new TestProperty(),
// new ChainBindTest(),
], reporter);
runner.run();
return runner.statusCode();
}
}