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

Function test_geojson_event_handler

tests/test_features.py:288–302  ·  view source on GitHub ↗

Test that event handlers are properly generated

()

Source from the content-addressed store, hash-verified

286
287
288def test_geojson_event_handler():
289 """Test that event handlers are properly generated"""
290 m = Map()
291 data = {"type": "FeatureCollection", "features": []}
292 geojson = GeoJson(data, style_function=lambda x: {}).add_to(m)
293 fn = JsCode(
294 """
295 function f(e) {
296 console.log("only for testing")
297 }
298 """
299 )
300 geojson.add_child(EventHandler("mouseover", fn))
301 rendered = m.get_root().render()
302 assert fn.js_code in rendered
303
304
305def test_geometry_collection_get_bounds():

Callers

nothing calls this directly

Calls 7

MapClass · 0.90
GeoJsonClass · 0.90
JsCodeClass · 0.90
EventHandlerClass · 0.90
add_toMethod · 0.80
add_childMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected