Code coverage report for lib/template/component.js

Statements: 31.25% (5 / 16)      Branches: 0% (0 / 4)      Functions: 0% (0 / 3)      Lines: 33.33% (5 / 15)      Ignored: none     

All files » lib/template/ » component.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 451 1 1         1             1                                                            
var BaseComponent = require("../components/base");
var _bind         = require("../utils/bind");
var _extend       = require("../utils/extend");
 
/**
 */
 
function TemplateComponent(options) {
  BaseComponent.call(this, options);
}
 
/**
 */
 
module.exports = BaseComponent.extend(TemplateComponent, {
 
  /**
   */
 
  bind: function() {
    this._bindings = [];
 
    this.childContext = new this.contextClass(this.attributes);
 
    if (!this.childView) {
      this.childView = this.template.view(this.childContext, {
        parent: this.view
      });
      this.section.appendChild(this.childView.render());
    } else {
      this.childView.setOptions({ parent: this.view });
      this.childView.bind(this.childContext);
    }
 
    BaseComponent.prototype.bind.call(this);
  },
 
  /**
   */
 
  unbind: function() {
    if (this.childView) this.childView.unbind();
  }
});