Skip to content

fix popup sticky options #2048

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions folium/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ def __init__(
self.lazy = lazy
self.options = dict(
max_width=max_width,
autoClose=False if show or sticky else None,
closeOnClick=False if sticky else None,
autoClose=not (show or sticky),
closeOnClick=not sticky,
**kwargs,
)

Expand Down
10 changes: 5 additions & 5 deletions tests/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_popup_show():
rendered = popup._template.render(this=popup, kwargs={})
expected = """
var {popup_name} = L.popup({{
"maxWidth": "100%","autoClose": false,"closeOnClick": null,
"maxWidth": "100%","autoClose": false,"closeOnClick": true,
}});
var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">Some text.</div>`)[0];
{popup_name}.setContent({html_name});
Expand All @@ -155,8 +155,8 @@ def test_popup_backticks():
expected = """
var {popup_name} = L.popup({{
"maxWidth": "100%",
"autoClose": null,
"closeOnClick": null,
"autoClose": true,
"closeOnClick": true,
}});
var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">back\\`tick\\`tick</div>`)[0];
{popup_name}.setContent({html_name});
Expand All @@ -176,8 +176,8 @@ def test_popup_backticks_already_escaped():
expected = """
var {popup_name} = L.popup({{
"maxWidth": "100%",
"autoClose": null,
"closeOnClick": null,
"autoClose": true,
"closeOnClick": true,
}});
var {html_name} = $(`<div id="{html_name}" style="width: 100.0%; height: 100.0%;">back\\`tick</div>`)[0];
{popup_name}.setContent({html_name});
Expand Down
Loading