chain binding, first result, WIP
This commit is contained in:
+25
-2
@@ -20,14 +20,36 @@ class ChainBindTest extends BuddySuite {
|
||||
before({
|
||||
b = new BindableChain();
|
||||
b.c = new BindableChain();
|
||||
b.c.c = new BindableChain();
|
||||
callNum = 0;
|
||||
});
|
||||
|
||||
it("BindExt.chain should bind chain changes", {
|
||||
it("BindExt.chain should bind chain changes (1 gap)", {
|
||||
b.c.f("tada").d = "a";
|
||||
BindExt.chain(b.c.f("tada").d, function (_, _) callNum++);
|
||||
var unbind = BindExt.chain(b.c.f("tada").d, function (_, t:String) {
|
||||
callNum++;
|
||||
t.should.be(b.c.f("tada").d);
|
||||
});
|
||||
|
||||
callNum.should.be(1);
|
||||
|
||||
b.c.f("tada").d = "b";
|
||||
callNum.should.be(2);
|
||||
|
||||
unbind();
|
||||
b.c.f("tada").d = "c";
|
||||
callNum.should.be(2);
|
||||
});
|
||||
|
||||
it("BindExt.chain should bind chain changes (double gap)", {
|
||||
b.c.c.d = "a";
|
||||
|
||||
BindExt.chain(b.c.c.d, function (_, _) callNum++);
|
||||
|
||||
callNum.should.be(1);
|
||||
|
||||
BindExt.chain(b.c.c.c.d, function (_, _) callNum++ );
|
||||
|
||||
callNum.should.be(1);
|
||||
});
|
||||
|
||||
@@ -43,6 +65,7 @@ class BindableChain implements bindx.IBindable {
|
||||
|
||||
public var nd:String;
|
||||
|
||||
|
||||
public var c:BindableChain;
|
||||
|
||||
@:bindable
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class Tests extends BuddySuite {
|
||||
new MetaTest(),
|
||||
new SignalTest(),
|
||||
new TestProperty(),
|
||||
// new ChainBindTest(),
|
||||
new ChainBindTest(),
|
||||
], reporter);
|
||||
|
||||
runner.run();
|
||||
|
||||
Reference in New Issue
Block a user