Skip to content

Commit 97d477b

Browse files
committed
Basic components
1 parent 8e4e857 commit 97d477b

21 files changed

+28459
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

__tests__/map.coffee

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jest.dontMock "../src/Map.coffee"
2+
3+
describe "Map", ->
4+
5+
it "should initialize the map in the rendered container", ->
6+
react = require "react"
7+
Map = require "../src/Map.coffee"
8+
9+
document.body.innerHTML = '<div id="test"></div>'
10+
map = react.renderComponent Map(), document.getElementById "test"
11+
node = map.getDOMNode()
12+
13+
expect(node._leaflet).toBe on

example/simple.coffee

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
react = require "react"
2+
L = require "../src"
3+
4+
SimpleExample = react.createClass
5+
displayName: "SimpleExample"
6+
render: ->
7+
L.Map
8+
center: [51.505, -0.09]
9+
zoom: 13
10+
L.TileLayer
11+
url: "http://{s}.tile.osm.org/{z}/{x}/{y}.png"
12+
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
13+
L.Marker
14+
position: [51.505, -0.09]
15+
16+
react.renderComponent SimpleExample(), document.getElementById "content"

example/simple.htm

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>react-leaflet example</title>
6+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css">
7+
<style>
8+
html, body {
9+
margin: 0;
10+
padding: 0;
11+
}
12+
html, body, #content, .leaflet-container {
13+
height: 100%;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div id="content"></div>
19+
<script src="/simple.js"></script>
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)