var dirname = __dirname.split('/').pop(),
  filename = __filename.split('/').pop().split('.').shift(),
  fixture = require('../test/fixtures/behavior')({}),
  stringify = require('../test/stringify'),
  dom = require('../services/dom'),
  lib = require('./component-ref.js'); // static-analysis means this must be string, not `('./' + filename)`

describe(dirname, function () {
  describe(filename, function () {
    var querySelectorClass = 'query-selector',
      anotherComponent = dom.create('<div class="' + querySelectorClass + '" data-uri="site.com/path/components/x/instances/0"></div>');

    beforeEach(function () {
      document.body.appendChild(anotherComponent);
    });

    afterEach(function () {
      document.body.removeChild(anotherComponent);
    });

    it('appends a hidden field', function () {
      var result = lib(fixture, {selector: '.' + querySelectorClass});

      expect(stringify(result.el)).to.eql('<input type="hidden" class="input-text" rv-field="foo" rv-value="foo.data.value">');
    });

  });
});

@@ -154,52 +154,8 @@
 %7D),%0A
-  stringify = require('../test/stringify'),%0A
   do
@@ -296,16 +296,322 @@
 name)%60%0A%0A
+/**%0A * Returns the first element even if within a document fragment.%0A * @param %7BDocumentFragment%7CElement%7D container%0A * @returns %7BElement%7D%0A */%0Afunction firstElement(container) %7B%0A  var isDocumentFragment = container.nodeType === 11;%0A%0A  return isDocumentFragment ? container.firstElementChild : container;%0A%7D%0A%0A
 describe
@@ -1151,119 +1151,253 @@
 ss%7D)
-;%0A
+,
 %0A      
-expect(stringify(result.el)).to.eql('%3C
+  input = firstElement(result.el);%0A%0A      expect(input.tagName).to.eql('INPUT');%0A      expect(
 input
- 
+.
 type
-=%22hidden%22 class=%22input-text%22 rv-field=%22foo%22 rv-value=%22
+).to.eql('hidden');%0A      expect(input.getAttribute('rv-field')).to.eql('foo');%0A      expect(input.getAttribute('rv-value')).to.eql('
 foo.
@@ -1406,18 +1406,16 @@
 ta.value
-%22%3E
 ');%0A    

Update test.