Code coverage report for src/components/buttons/practice-button.cjsx

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

All files » src/components/buttons/ » practice-button.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                                                                          
var BS, PracticeButton, React;
 
React = require('react');
 
BS = require('react-bootstrap');
 
PracticeButton = React.createClass({
  displayName: 'PracticeButton',
  contextTypes: {
    router: React.PropTypes.func
  },
  propTypes: {
    courseId: React.PropTypes.string.isRequired,
    pageIds: React.PropTypes.arrayOf(React.PropTypes.string),
    showAll: React.PropTypes.bool.isRequired
  },
  goToPractice: function() {
    var courseId, pageIds, query, ref;
    ref = this.props, courseId = ref.courseId, pageIds = ref.pageIds;
    query = {};
    if (pageIds) {
      query.page_ids = pageIds;
    }
    return this.context.router.transitionTo('viewPractice', {
      courseId: courseId
    }, query);
  },
  render: function() {
    var text;
    text = 'Practice this ';
    text += this.props.showAll ? 'chapter' : 'section';
    return React.createElement(BS.Button, {
      "bsStyle": 'primary',
      "className": '-practice',
      "onClick": this.goToPractice
    }, text);
  }
});
 
module.exports = PracticeButton;