UNPKG

@danielkalen/simplybind

Version:

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

58 lines (39 loc) 1.21 kB
suite "SimplyBind() function", ()-> test "Can only accept an object type of String, Number, Array, Function, or an existing binding instance", ()-> expect ()-> SimplyBind('s') .not.to.throw() expect ()-> SimplyBind(0) .not.to.throw() expect ()-> SimplyBind([]) .not.to.throw() expect ()-> SimplyBind(()->) .not.to.throw() expect ()-> SimplyBind(SimplyBind('prop1').of(objectA)) .not.to.throw() expect ()-> SimplyBind(true) .to.throw() expect ()-> SimplyBind(null) .to.throw() expect ()-> SimplyBind(undefined) .to.throw() expect ()-> SimplyBind({}) .to.throw() expect ()-> SimplyBind(new Date()) .to.throw() if isBrowser expect ()-> SimplyBind($('<div />')[0]) .to.throw() if window.Map and window.Set and window.Symbol expect ()-> SimplyBind(new Map()) .to.throw() expect ()-> SimplyBind(new WeakMap()) .to.throw() expect ()-> SimplyBind(new Set()) .to.throw() expect ()-> SimplyBind(new WeakSet()) .to.throw() expect ()-> SimplyBind(Symbol('a')) .to.throw() test "Should throw when passing an empty string", ()-> expect ()-> SimplyBind('') .to.throw()