Skip to content

Commit 7e8d0b6

Browse files
committed
Fix init test and add tests for global switches
1 parent f61ec5e commit 7e8d0b6

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

folium/templates/fol_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<head>
33
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4-
4+
<script>L_PREFER_CANVAS=false; L_NO_TOUCH=false; L_DISABLE_3D=false;</script>
55
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
66
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
77
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

tests/test_folium.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def test_init(self):
8080
assert self.map.width == (900, 'px')
8181
assert self.map.left == (0, '%')
8282
assert self.map.top == (0, '%')
83+
assert self.map.global_switches.prefer_canvas is False
84+
assert self.map.global_switches.no_touch is False
85+
assert self.map.global_switches.disable_3d is False
8386
assert self.map.to_dict() == {
8487
"name": "Map",
8588
"id": "00000000000000000000000000000000",
@@ -422,3 +425,24 @@ def test_tile_layer(self):
422425

423426
bounds = self.map.get_bounds()
424427
assert bounds == [[None, None], [None, None]], bounds
428+
429+
def test_global_switches(self):
430+
mapa = folium.Map(prefer_canvas=True)
431+
assert (mapa.global_switches.prefer_canvas is True and
432+
mapa.global_switches.no_touch is False and
433+
mapa.global_switches.disable_3d is False)
434+
435+
mapb = folium.Map(no_touch=True)
436+
assert (mapb.global_switches.prefer_canvas is False and
437+
mapb.global_switches.no_touch is True and
438+
mapb.global_switches.disable_3d is False)
439+
440+
mapc = folium.Map(disable_3d=True)
441+
assert (mapc.global_switches.prefer_canvas is False and
442+
mapc.global_switches.no_touch is False and
443+
mapc.global_switches.disable_3d is True)
444+
445+
mapd = folium.Map(prefer_canvas=True, no_touch=True, disable_3d=True)
446+
assert (mapd.global_switches.prefer_canvas is True and
447+
mapd.global_switches.no_touch is True and
448+
mapd.global_switches.disable_3d is True)

0 commit comments

Comments
 (0)