Code coverage report for lib/mixins/mapLayer.js

Statements: 42.86% (6 / 14)      Branches: 50% (3 / 6)      Functions: 20% (1 / 5)      Lines: 38.46% (5 / 13)      Ignored: none     

All files » lib/mixins/ » 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    3   1   1   1   1                                            
"use strict";
 
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
 
var assign = _interopRequire(require("lodash/object/assign"));
 
var React = _interopRequire(require("react"));
 
var elementMixin = _interopRequire(require("./element"));
 
module.exports = {
  mixins: [elementMixin],
 
  componentDidMount: function componentDidMount() {
    this.props.map.addLayer(this.getLeafletElement());
  },
 
  componentWillUnmount: function componentWillUnmount() {
    this.props.map.removeLayer(this.getLeafletElement());
  },
 
  getClonedChildrenWithMap: 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;
    });
  }
};