# Code coverage report for lib/components/show.js

## Statements: 100% (14 / 14) Branches: 100% (6 / 6) Functions: 100% (2 / 2) Lines: 100% (12 / 12) Ignored: none

All files » lib/components/ » show.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
    351

    1
    4

    1

    9

    9

    7

    7
    4
    4

    3
    3

     var BaseComponent  = require("./base");

    /**
     */

    function ShowComponent(options) {
      BaseComponent.call(this, options);
    }

    /**
     */

    module.exports = BaseComponent.extend(ShowComponent, {

      /**
       */

      update: function() {

        var show = !!this.attributes.when;

        if (this._show === show) return;

        this._show = show;

        if (show) {
          this._view = this.childTemplate.view(this.view.context);
          this.section.appendChild(this._view.render());
        } else {
          if (this._view) this._view.dispose();
          this._view = void 0;
        }
      }
    });