parent
2fa1d42ee7
commit
371af7827f
2 changed files with 19 additions and 11 deletions
|
@ -125,18 +125,12 @@ U.Map = L.Map.extend({
|
|||
// To be used in javascript APIs
|
||||
if (geojson.properties.lang) L.lang = geojson.properties.lang
|
||||
|
||||
// Don't let default autocreation of controls
|
||||
const zoomControl =
|
||||
typeof geojson.properties.zoomControl !== 'undefined'
|
||||
? geojson.properties.zoomControl
|
||||
: true
|
||||
geojson.properties.zoomControl = false
|
||||
const fullscreenControl =
|
||||
typeof geojson.properties.fullscreenControl !== 'undefined'
|
||||
? geojson.properties.fullscreenControl
|
||||
: true
|
||||
geojson.properties.fullscreenControl = false
|
||||
this.setOptionsFromQueryString(geojson.properties)
|
||||
// Prevent default creation of controls
|
||||
const zoomControl = geojson.properties.zoomControl
|
||||
const fullscreenControl = geojson.properties.fullscreenControl
|
||||
geojson.properties.zoomControl = false
|
||||
geojson.properties.fullscreenControl = false
|
||||
|
||||
L.Map.prototype.initialize.call(this, el, geojson.properties)
|
||||
U.DEFAULT_ICON_URL = this.options.default_iconUrl
|
||||
|
|
|
@ -50,3 +50,17 @@ def test_can_deactivate_wheel_from_query_string(map, live_server, page):
|
|||
expect(page).to_have_url(re.compile(r".*#7/.+"))
|
||||
page.mouse.wheel(0, 1)
|
||||
expect(page).to_have_url(re.compile(r".*#7/.+"))
|
||||
|
||||
|
||||
def test_zoom_control(map, live_server, datalayer, page):
|
||||
control = page.locator(".leaflet-control-zoom")
|
||||
page.goto(f"{live_server.url}{map.get_absolute_url()}")
|
||||
expect(control).to_be_visible()
|
||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?zoomControl=false")
|
||||
expect(control).to_be_hidden()
|
||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?zoomControl=true")
|
||||
expect(control).to_be_visible()
|
||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?zoomControl=null")
|
||||
expect(control).to_be_hidden()
|
||||
page.get_by_title("More controls").click()
|
||||
expect(control).to_be_visible()
|
||||
|
|
Loading…
Reference in a new issue