Skip to content

Commit

Permalink
Fix node test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed May 13, 2024
1 parent 9785a05 commit 9f2b989
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 14 additions & 3 deletions leaflet/static/leaflet/leaflet.extras.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ L.Control.ResetView = L.Control.extend({
};

L.Util.setOptions(this, options);
L.Control.ResetView.TITLE = JSON.parse(document.getElementById("Control-ResetView-TITLE").textContent);
L.Control.ResetView.ICON = JSON.parse(document.getElementById("Control-ResetView-ICON").textContent);

const titleElement = document.getElementById("Control-ResetView-TITLE");
const iconElement = document.getElementById("Control-ResetView-TITLE");

This comment has been minimized.

Copy link
@brendonsa

brendonsa Jun 20, 2024

Shouldn't this be Control-ResetView-ICON?

This comment has been minimized.

Copy link
@Gagaro

Gagaro Jul 15, 2024

Author Member

Indeed, nice catch. Thanks 👍 .


if (!!titleElement) {
L.Control.ResetView.TITLE = JSON.parse(titleElement.textContent);
}
if (!!iconElement) {
L.Control.ResetView.ICON = JSON.parse(iconElement.textContent);
}
},

onAdd: function (map) {
Expand Down Expand Up @@ -258,5 +266,8 @@ L.Map.djangoMap = function (id, options) {
}
};

const imgPathElement = document.getElementById("force-img-path");

L.Icon.Default.imagePath = JSON.parse(document.getElementById("force-img-path").textContent);
if (!!imgPathElement) {
L.Icon.Default.imagePath = JSON.parse(imgPathElement.textContent);
}
2 changes: 2 additions & 0 deletions leaflet/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

<textarea id="formfield"></textarea>

<script id="force-img-path">'foobar'</script>

<script>mocha.setup('bdd')</script>
<script src="test.extras.js"></script>
<script src="test.forms.js"></script>
Expand Down

0 comments on commit 9f2b989

Please sign in to comment.