Code coverage report for src/components/navbar/notifications-bar.cjsx

Statements: 59.09% (13 / 22)      Branches: 50% (1 / 2)      Functions: 25% (1 / 4)      Lines: 59.09% (13 / 22)      Ignored: none     

All files » src/components/navbar/ » notifications-bar.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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63                                                             99× 99× 99× 99×                                        
var BindStoreMixin, Icon, Notification, NotificationActions, NotificationBar, NotificationStore, React, _, ref;
 
React = require('react');
 
_ = require('underscore');
 
Icon = require('../icon');
 
ref = require('../../flux/notifications'), NotificationStore = ref.NotificationStore, NotificationActions = ref.NotificationActions;
 
BindStoreMixin = require('../bind-store-mixin');
 
Notification = React.createClass({displayName: "Notification",
  propTypes: {
    notice: React.PropTypes.shape({
      id: React.PropTypes.string.isRequired,
      message: React.PropTypes.string.isRequired
    }).isRequired
  },
  acknowledge: function() {
    return NotificationActions.acknowledge(this.props.notice.id);
  },
  render: function() {
    return React.createElement("div", {
      "className": "notification"
    }, React.createElement(Icon, {
      "type": 'info-circle'
    }), this.props.notice.message, React.createElement("a", {
      "className": 'dismiss',
      "onClick": this.acknowledge
    }, "Dismiss"));
  }
});
 
NotificationBar = React.createClass({displayName: "NotificationBar",
  mixins: [BindStoreMixin],
  bindStore: NotificationStore,
  render: function() {
    var notice, notifications;
    notifications = NotificationStore.getActiveNotifications();
    Eif (_.isEmpty(notifications)) {
      return null;
    }
    return React.createElement("div", {
      "className": "notifications-bar"
    }, (function() {
      var i, len, results;
      results = [];
      for (i = 0, len = notifications.length; i < len; i++) {
        notice = notifications[i];
        results.push(React.createElement(Notification, {
          "key": notice.id,
          "notice": notice
        }));
      }
      return results;
    })());
  }
});
 
module.exports = NotificationBar;