mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: do not show "back to home" button in iframes
Co-authored-by: David Larlet <david@larlet.fr>
This commit is contained in:
parent
071a8c539d
commit
d9e983aed4
2 changed files with 26 additions and 1 deletions
|
@ -108,7 +108,7 @@ export default class Umap {
|
||||||
|
|
||||||
// Do not display in an iframe.
|
// Do not display in an iframe.
|
||||||
if (window.self !== window.top) {
|
if (window.self !== window.top) {
|
||||||
geojson.properties.homeControl = false
|
this.properties.homeControl = false
|
||||||
}
|
}
|
||||||
|
|
||||||
this._leafletMap.setup()
|
this._leafletMap.setup()
|
||||||
|
|
25
umap/tests/integration/test_iframe.py
Normal file
25
umap/tests/integration/test_iframe.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
from playwright.sync_api import expect
|
||||||
|
|
||||||
|
|
||||||
|
def test_home_control_is_hidden(live_server, map, tilelayer, page):
|
||||||
|
body = f"""
|
||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>
|
||||||
|
<iframe width="100%" height="300px" frameborder="0" allowfullscreen allow="geolocation"
|
||||||
|
src="{map.get_absolute_url()}?scaleControl=false&miniMap=false&scrollWheelZoom=false&zoomControl=true&editMode=disabled&moreControl=true&searchControl=null&tilelayersControl=null&embedControl=null&datalayersControl=true&onLoadPanel=caption&captionBar=false&captionMenus=true"></iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
def handle(route):
|
||||||
|
route.fulfill(body=body)
|
||||||
|
|
||||||
|
url = f"{live_server.url}/test-iframe"
|
||||||
|
# Intercept the route
|
||||||
|
page.route(url, handle)
|
||||||
|
|
||||||
|
page.goto(url)
|
||||||
|
expect(
|
||||||
|
page.locator("iframe").content_frame.get_by_role("link", name="Home logo")
|
||||||
|
).to_be_hidden()
|
Loading…
Reference in a new issue