Ejemplo n.º 1
0
module.exports = function (result) {
  var name = result.name;

  result.bindings.data.value = dom.uri(); // returns the current uri (for now)
  // todo: if behaviors supported promises, we could get the full page id
  result.el.appendChild(dom.create(`<input type="hidden" class="input-text" rv-field="${name}" rv-value="${name}.data.value" />`));

  return result;
};
Ejemplo n.º 2
0
    it('appends a hidden field and adds URI to binding value', function () {
      var result = lib(fixture),
        input = result.el.firstElementChild; // inside a DocumentFragment

      expect(result.bindings.data.value).to.eql(dom.uri());
      expect(input.tagName).to.eql('INPUT');
      expect(input.type).to.eql('hidden');
      expect(input.className).to.eql('input-text');
      expect(input.getAttribute('rv-field')).to.eql('foo');
      expect(input.getAttribute('rv-value')).to.eql('foo.data.value');
    });