Skip to content

Commit 2e6f3da

Browse files
committed
Add test for DualMap
1 parent 5753d63 commit 2e6f3da

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/plugins/test_dual_map.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
Test DualMap
5+
------------
6+
"""
7+
8+
from __future__ import (absolute_import, division, print_function)
9+
10+
from jinja2 import Template
11+
12+
import folium
13+
import folium.plugins
14+
15+
16+
def test_dual_map():
17+
m = folium.plugins.DualMap((0, 0))
18+
19+
folium.FeatureGroup(name='both').add_to(m)
20+
folium.FeatureGroup(name='left').add_to(m.m1)
21+
folium.FeatureGroup(name='right').add_to(m.m2)
22+
23+
figure = m.get_root()
24+
assert isinstance(figure, folium.Figure)
25+
out = figure.render()
26+
27+
script = '<script src="https://rawcdn.githack.com/jieter/Leaflet.Sync/master/L.Map.Sync.js"></script>' # noqa
28+
assert script in out
29+
30+
tmpl = Template("""
31+
{{ this.m1.get_name() }}.sync({{ this.m2.get_name() }});
32+
{{ this.m2.get_name() }}.sync({{ this.m1.get_name() }});
33+
""")
34+
35+
assert tmpl.render(this=m) in out

0 commit comments

Comments
 (0)