MCPcopy
hub / github.com/python-visualization/folium / test_popup_sticky

Function test_popup_sticky

tests/test_map.py:109–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107
108
109def test_popup_sticky():
110 m = Map()
111 popup = Popup("Some text.", sticky=True).add_to(m)
112 rendered = popup._template.render(this=popup, kwargs={})
113 expected = """
114 var {popup_name} = L.popup({{
115 "maxWidth": "100%",
116 "autoClose": false,
117 "closeOnClick": false,
118 }});
119
120 var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">Some text.</div>`)[0];
121 {popup_name}.setContent({html_name});
122 {map_name}.bindPopup({popup_name});
123 """.format(
124 popup_name=popup.get_name(),
125 html_name=list(popup.html._children.keys())[0],
126 map_name=m.get_name(),
127 )
128 assert normalize(rendered) == normalize(expected)
129
130
131def test_popup_show():

Callers

nothing calls this directly

Calls 5

MapClass · 0.90
PopupClass · 0.90
normalizeFunction · 0.90
add_toMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected