| 10 | |
| 11 | |
| 12 | def test_dual_map(): |
| 13 | m = folium.plugins.DualMap((0, 0)) |
| 14 | |
| 15 | folium.FeatureGroup(name="both").add_to(m) |
| 16 | folium.FeatureGroup(name="left").add_to(m.m1) |
| 17 | folium.FeatureGroup(name="right").add_to(m.m2) |
| 18 | |
| 19 | figure = m.get_root() |
| 20 | assert isinstance(figure, folium.Figure) |
| 21 | out = normalize(figure.render()) |
| 22 | |
| 23 | script = '<script src="https://cdn.jsdelivr.net/gh/jieter/Leaflet.Sync/L.Map.Sync.min.js"></script>' # noqa |
| 24 | assert script in out |
| 25 | |
| 26 | tmpl = Template( |
| 27 | """ |
| 28 | {{ this.m1.get_name() }}.sync({{ this.m2.get_name() }}); |
| 29 | {{ this.m2.get_name() }}.sync({{ this.m1.get_name() }}); |
| 30 | """ |
| 31 | ) |
| 32 | |
| 33 | assert normalize(tmpl.render(this=m)) in out |