UNPKG

@danielkalen/simplybind

Version:

Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.

31 lines (21 loc) 956 B
suite "Internal Behavior", ()-> suiteSetup(restartSandbox) import './method-availability' import './cached-bindings' test "A binding should have the correct public properies available", ()-> binding = SimplyBind('prop1').of(objectA).to('prop2').of(objectB) expect(binding.value).not.to.be.undefined expect(binding.original).not.to.be.undefined expect(binding.subscribers).not.to.be.undefined expect(binding._).not.to.be.undefined restartSandbox() test "Bindings to a nonexistent object prop should not create instantiate the object prop at first", ()-> expect(objectA.prop20).to.be.undefined expect(objectB.prop20).to.be.undefined binding = SimplyBind('prop20').of(objectA).to('prop20').of(objectB) expect(objectA.prop20).to.be.undefined expect(objectB.prop20).to.be.undefined binding.set 'new value' expect(objectA.prop20).to.equal 'new value' expect(objectB.prop20).to.equal 'new value' restartSandbox()