Skip to content

Commit 074af11

Browse files
committed
Popup tests
1 parent b3b4085 commit 074af11

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/test_map.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
Folium map Tests
5+
----------------
6+
7+
"""
8+
from folium.map import Popup # TODO: Map, Marker, ...
9+
10+
11+
tmpl = """
12+
<div id="{id}"
13+
style="width: {width}; height: {height};">
14+
{text}</div>
15+
""".format
16+
17+
18+
def test_popup_ascii():
19+
popup = Popup('Some text.')
20+
kw = dict(id=popup.html._children.items()[0][0],
21+
width='100.0%',
22+
height='100.0%',
23+
text='Some text.')
24+
assert popup.html.render().strip() == tmpl(**kw).strip()
25+
26+
27+
def test_popup_quotes():
28+
popup = Popup("Let's try quotes")
29+
kw = dict(id=popup.html._children.items()[0][0],
30+
width='100.0%',
31+
height='100.0%',
32+
text='Let&#39;s try quotes')
33+
assert popup.html.render().strip() == tmpl(**kw).strip()
34+
35+
36+
def test_popup_unicode():
37+
popup = Popup("Ça c'est chouette")
38+
kw = dict(id=popup.html._children.items()[0][0],
39+
width='100.0%',
40+
height='100.0%',
41+
text="&#199;a c'est chouette")
42+
assert popup.html.render().strip() == tmpl(**kw).strip()

0 commit comments

Comments
 (0)