Code coverage report for src/components/scores/sorting-header.cjsx

Statements: 26.67% (4 / 15)      Branches: 0% (0 / 10)      Functions: 0% (0 / 3)      Lines: 26.67% (4 / 15)      Ignored: none     

All files » src/components/scores/ » sorting-header.cjsx
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                                                                              
var React, Router;
 
React = require('react');
 
Router = require('react-router');
 
module.exports = React.createClass({
  displayName: 'SortingHeader',
  propTypes: {
    onSort: React.PropTypes.func.isRequired,
    sortKey: React.PropTypes.any.isRequired,
    sortState: React.PropTypes.object.isRequired,
    dataType: React.PropTypes.string
  },
  onClick: function() {
    return this.props.onSort(this.props.sortKey, this.props.children.ref);
  },
  isSplitHeader: function() {
    if (this.props.dataType != null) {
      if (this.props.dataType === this.props.children.ref) {
        return true;
      } else {
        return false;
      }
    } else {
      return true;
    }
  },
  render: function() {
    var classNames;
    classNames = ['header-cell', 'sortable', this.props.className];
    if (this.props.sortState.key === this.props.sortKey && this.isSplitHeader()) {
      classNames.push(this.props.sortState.asc ? 'is-ascending' : 'is-descending');
    }
    return React.createElement("div", {
      "data-assignment-type": this.props.type,
      "onClick": this.onClick,
      "className": classNames.join(' ')
    }, this.props.children);
  }
});