Code coverage report for lib/MapLayer.js

Statements: 78.33% (47 / 60)      Branches: 52.94% (18 / 34)      Functions: 92.31% (12 / 13)      Lines: 92.59% (25 / 27)      Ignored: none     

All files » lib/ » MapLayer.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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61    3   3   1   1   1   1   1   1   1 1 1   1 1       1   1     1 1                     1 1 1   1   1 1           1     1
"use strict";
 
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
 
var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; Eif (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
 
var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); Iif (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else Eif ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
 
var _inherits = function (subClass, superClass) { Iif (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); Eif (superClass) subClass.__proto__ = superClass; };
 
var _classCallCheck = function (instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
 
var assign = _interopRequire(require("lodash/object/assign"));
 
var React = _interopRequire(require("react"));
 
var MapComponent = _interopRequire(require("./MapComponent"));
 
var MapLayer = (function (_MapComponent) {
  function MapLayer() {
    _classCallCheck(this, MapLayer);
 
    Eif (_MapComponent != null) {
      _MapComponent.apply(this, arguments);
    }
  }
 
  _inherits(MapLayer, _MapComponent);
 
  _createClass(MapLayer, {
    componentDidMount: {
      value: function componentDidMount() {
        _get(Object.getPrototypeOf(MapLayer.prototype), "componentDidMount", this).call(this);
        this.props.map.addLayer(this.leafletElement);
      }
    },
    componentWillUnmount: {
      value: function componentWillUnmount() {
        _get(Object.getPrototypeOf(MapLayer.prototype), "componentWillUnmount", this).call(this);
        this.props.map.removeLayer(this.leafletElement);
      }
    },
    getClonedChildrenWithMap: {
      value: function getClonedChildrenWithMap(extra) {
        var _props = this.props;
        var children = _props.children;
        var map = _props.map;
 
        var props = assign({ map: map }, extra);
 
        return React.Children.map(children, function (child) {
          return child ? React.cloneElement(child, props) : null;
        });
      }
    }
  });
 
  return MapLayer;
})(MapComponent);
 
module.exports = MapLayer;