@@ -89,6 +89,36 @@ def test_popup_show():
8989 assert normalize (rendered ) == normalize (expected )
9090
9191
92+ def test_popup_backticks ():
93+ m = Map ()
94+ popup = Popup ('back`tick`tick' ).add_to (m )
95+ rendered = popup ._template .render (this = popup , kwargs = {})
96+ expected = """
97+ var {popup_name} = L.popup({{"maxWidth": "100%"}});
98+ var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">back\\ `tick\\ `tick</div>`)[0];
99+ {popup_name}.setContent({html_name});
100+ {map_name}.bindPopup({popup_name});
101+ """ .format (popup_name = popup .get_name (),
102+ html_name = list (popup .html ._children .keys ())[0 ],
103+ map_name = m .get_name ())
104+ assert normalize (rendered ) == normalize (expected )
105+
106+
107+ def test_popup_backticks_already_escaped ():
108+ m = Map ()
109+ popup = Popup ('back\\ `tick' ).add_to (m )
110+ rendered = popup ._template .render (this = popup , kwargs = {})
111+ expected = """
112+ var {popup_name} = L.popup({{"maxWidth": "100%"}});
113+ var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">back\\ `tick</div>`)[0];
114+ {popup_name}.setContent({html_name});
115+ {map_name}.bindPopup({popup_name});
116+ """ .format (popup_name = popup .get_name (),
117+ html_name = list (popup .html ._children .keys ())[0 ],
118+ map_name = m .get_name ())
119+ assert normalize (rendered ) == normalize (expected )
120+
121+
92122def test_icon_valid_marker_colors ():
93123 assert len (Icon .color_options ) == 19
94124 with pytest .warns (None ) as record :
0 commit comments