From 7d68dfcf1d0c3d5467f1a4c92ce4b0d3528892c9 Mon Sep 17 00:00:00 2001 From: Dima Granetchi Date: Sun, 16 Nov 2014 02:33:16 +0200 Subject: [PATCH] force test --- test/ForceTest.hx | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/test/ForceTest.hx b/test/ForceTest.hx index c8abe95..7c014e9 100644 --- a/test/ForceTest.hx +++ b/test/ForceTest.hx @@ -12,8 +12,47 @@ class ForceTest extends BuddySuite { describe("Using @:bindable(force=true)", { - it("bindx should correct work with readonly fields"); + var b:BindableForce; + var callNum:Int; + + before({ + b = new BindableForce(); + callNum = 0; + }); + + it("bindx should correct work with 'force' fields", { + Bind.bind(b.str, function (_, _) callNum++); + Bind.bind(b.str2, function (_, _) callNum++); + Bind.bind(b.str3, function (_, _) callNum++); + Bind.bind(b.str4, function (_, _) callNum++); + Bind.bind(b.str5, function (_, _) callNum++); + + Bind.notify(b.str, "1", "2"); + Bind.notify(b.str2, "1", "2"); + Bind.notify(b.str3, "1", "2"); + Bind.notify(b.str4, "1", "2"); + Bind.notify(b.str5, "1", "2"); + + callNum.should.be(5); + }); }); } +} + +@:bindable(force=true) +class BindableForce implements bindx.IBindable { + + public var str(default, never):String; + + public var str2(default, null):String; + + public var str3(default, dynamic):String; + + public var str4(null, never):String; + + public var str5(dynamic, null):String; + + public function new() { + } } \ No newline at end of file