@danielkalen/simplybind
Version:
Magically simple, framework-less one-way/two-way data binding for frontend/backend in ~5kb.
20 lines (16 loc) • 836 B
text/coffeescript
suite "DOMAttr", ()->
suiteSetup ()-> if not isBrowser then
test "Requires the 'attr:' prefix in the property name in order to bind the attribute values and not the property values", ()->
nonPrefix = SimplyBind('first').of(regA).to('first').of(regB)
withPrefix = SimplyBind('attr:second').of(regA).to('attr:second').of(regB)
nonPrefix.set 'someValue'
expect(regA.first).to.equal 'someValue'
expect(regB.first).to.equal 'someValue'
expect(regA.getAttribute 'first').not.to.equal 'someValue'
expect(regB.getAttribute 'first').not.to.equal 'someValue'
withPrefix.set 'someValue'
expect(regA.second).not.to.equal 'someValue'
expect(regB.second).not.to.equal 'someValue'
expect(regA.getAttribute 'second').to.equal 'someValue'
expect(regB.getAttribute 'second').to.equal 'someValue'
restartSandbox()