[Pkg-javascript-commits] [leaflet] 94/301: fix images 404 warnings in specs
Jonas Smedegaard
js at moszumanska.debian.org
Mon Jan 27 22:22:44 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet.
commit a086b336b22b9ff5b99de7c4338837c77946ae89
Author: Vladimir Agafonkin <agafonkin at gmail.com>
Date: Thu Sep 12 13:14:00 2013 +0300
fix images 404 warnings in specs
---
spec/suites/layer/marker/MarkerSpec.js | 50 ++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 21 deletions(-)
diff --git a/spec/suites/layer/marker/MarkerSpec.js b/spec/suites/layer/marker/MarkerSpec.js
index 082de25..86117c9 100644
--- a/spec/suites/layer/marker/MarkerSpec.js
+++ b/spec/suites/layer/marker/MarkerSpec.js
@@ -1,31 +1,39 @@
describe("Marker", function () {
var map,
- spy;
+ spy,
+ icon1,
+ icon2;
+
beforeEach(function () {
map = L.map(document.createElement('div')).setView([0, 0], 0);
+ icon1 = new L.Icon.Default();
+ icon2 = new L.Icon.Default({
+ iconUrl: icon1._getIconUrl('icon') + '?2',
+ shadowUrl: icon1._getIconUrl('shadow') + '?2'
+ });
});
describe("#setIcon", function () {
it("changes the icon to another image", function () {
- var marker = new L.Marker([0, 0], {icon: new L.Icon({iconUrl: 'icon1.png' }) });
+ var marker = new L.Marker([0, 0], {icon: icon1});
map.addLayer(marker);
-
+
var beforeIcon = marker._icon;
- marker.setIcon(new L.Icon({iconUrl: 'icon2.png' }));
+ marker.setIcon(icon2);
var afterIcon = marker._icon;
-
+
expect(beforeIcon).to.be(afterIcon);
- expect(afterIcon.src).to.contain('icon2.png');
+ expect(afterIcon.src).to.contain(icon2._getIconUrl('icon'));
});
it("changes the icon to another DivIcon", function () {
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
map.addLayer(marker);
-
+
var beforeIcon = marker._icon;
marker.setIcon(new L.DivIcon({html: 'Inner2Text' }));
var afterIcon = marker._icon;
-
+
expect(beforeIcon).to.be(afterIcon);
expect(afterIcon.innerHTML).to.contain('Inner2Text');
});
@@ -33,10 +41,10 @@ describe("Marker", function () {
it("removes text when changing to a blank DivIcon", function () {
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
map.addLayer(marker);
-
+
marker.setIcon(new L.DivIcon());
var afterIcon = marker._icon;
-
+
expect(marker._icon.innerHTML).to.not.contain('Inner1Text');
});
@@ -44,37 +52,37 @@ describe("Marker", function () {
var marker = new L.Marker([0, 0], {icon: new L.DivIcon({html: 'Inner1Text' }) });
map.addLayer(marker);
var oldIcon = marker._icon;
-
- marker.setIcon(new L.Icon({iconUrl: 'icon1.png' }));
-
+
+ marker.setIcon(icon1);
+
expect(oldIcon).to.not.be(marker._icon);
expect(oldIcon.parentNode).to.be(null);
-
- expect(marker._icon.src).to.contain('icon1.png');
+
+ expect(marker._icon.src).to.contain('marker-icon.png');
expect(marker._icon.parentNode).to.be(map._panes.markerPane);
});
it("changes an image to a DivIcon", function () {
- var marker = new L.Marker([0, 0], {icon: new L.Icon({iconUrl: 'icon1.png' }) });
+ var marker = new L.Marker([0, 0], {icon: icon1});
map.addLayer(marker);
var oldIcon = marker._icon;
marker.setIcon(new L.DivIcon({html: 'Inner1Text' }));
-
+
expect(oldIcon).to.not.be(marker._icon);
expect(oldIcon.parentNode).to.be(null);
-
+
expect(marker._icon.innerHTML).to.contain('Inner1Text');
expect(marker._icon.parentNode).to.be(map._panes.markerPane);
});
it("reuses the icon/shadow when changing icon", function () {
- var marker = new L.Marker([0, 0], { icon: new L.Icon({ iconUrl: 'icon1.png', shadowUrl: 'shadow1.png', }) });
+ var marker = new L.Marker([0, 0], { icon: icon1});
map.addLayer(marker);
var oldIcon = marker._icon;
var oldShadow = marker._shadow;
- marker.setIcon(new L.Icon({ iconUrl: 'icon2.png', shadowUrl: 'shadow2.png', }));
+ marker.setIcon(icon2);
expect(oldIcon).to.be(marker._icon);
expect(oldShadow).to.be(marker._shadow);
@@ -83,4 +91,4 @@ describe("Marker", function () {
expect(marker._shadow.parentNode).to.be(map._panes.shadowPane);
});
});
-});
\ No newline at end of file
+});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet.git
More information about the Pkg-javascript-commits
mailing list