parent
24acd5c42d
commit
2a084466df
2 changed files with 21 additions and 1 deletions
|
@ -226,6 +226,8 @@ U.IframeExporter = L.Evented.extend({
|
||||||
const datalayers = []
|
const datalayers = []
|
||||||
if (this.options.viewCurrentFeature && this.map.currentFeature) {
|
if (this.options.viewCurrentFeature && this.map.currentFeature) {
|
||||||
this.queryString.feature = this.map.currentFeature.getSlug()
|
this.queryString.feature = this.map.currentFeature.getSlug()
|
||||||
|
} else {
|
||||||
|
delete this.queryString.feature
|
||||||
}
|
}
|
||||||
if (this.options.keepCurrentDatalayers) {
|
if (this.options.keepCurrentDatalayers) {
|
||||||
this.map.eachDataLayer((datalayer) => {
|
this.map.eachDataLayer((datalayer) => {
|
||||||
|
|
|
@ -6,7 +6,7 @@ from playwright.sync_api import expect
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
|
|
||||||
def test_iframe_code(map, live_server, datalayer, page):
|
def test_iframe_code_can_contain_datalayers(map, live_server, datalayer, page):
|
||||||
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
||||||
textarea = page.locator(".umap-share-iframe")
|
textarea = page.locator(".umap-share-iframe")
|
||||||
expect(textarea).to_be_visible()
|
expect(textarea).to_be_visible()
|
||||||
|
@ -20,3 +20,21 @@ def test_iframe_code(map, live_server, datalayer, page):
|
||||||
page.get_by_text("Embed and link options").click()
|
page.get_by_text("Embed and link options").click()
|
||||||
page.get_by_title("Keep current visible layers").click()
|
page.get_by_title("Keep current visible layers").click()
|
||||||
expect(textarea).to_have_text(re.compile(f"datalayers={datalayer.pk}"))
|
expect(textarea).to_have_text(re.compile(f"datalayers={datalayer.pk}"))
|
||||||
|
# Now click again
|
||||||
|
page.get_by_title("Keep current visible layers").click()
|
||||||
|
expect(textarea).not_to_have_text(re.compile(f"datalayers={datalayer.pk}"))
|
||||||
|
|
||||||
|
|
||||||
|
def test_iframe_code_can_contain_feature(map, live_server, datalayer, page):
|
||||||
|
page.goto(f"{live_server.url}{map.get_absolute_url()}?share")
|
||||||
|
page.locator(".icon_container").click()
|
||||||
|
textarea = page.locator(".umap-share-iframe")
|
||||||
|
expect(textarea).to_be_visible()
|
||||||
|
expect(textarea).not_to_have_text(re.compile("feature=Here"))
|
||||||
|
# Open options
|
||||||
|
page.get_by_text("Embed and link options").click()
|
||||||
|
page.get_by_title("Open current feature on load").click()
|
||||||
|
expect(textarea).to_have_text(re.compile("feature=Here"))
|
||||||
|
# Click again to deactivate it
|
||||||
|
page.get_by_title("Open current feature on load").click()
|
||||||
|
expect(textarea).not_to_have_text(re.compile("feature=Here"))
|
||||||
|
|
Loading…
Reference in a new issue