diff --git a/spec/suites/layer/marker/MarkerSpec.js b/spec/suites/layer/marker/MarkerSpec.js index c99b288f..9b22dcc2 100644 --- a/spec/suites/layer/marker/MarkerSpec.js +++ b/spec/suites/layer/marker/MarkerSpec.js @@ -57,6 +57,22 @@ describe("Marker", function () { expect(icon.style.height).to.be(expectedXY + 'px'); }); + it("set the correct x and y size attributes passing a L.Point instance", function () { + var expectedXY = 96; + var sizedIcon = new L.Icon.Default({ + iconUrl: icon1._getIconUrl('icon') + '?3', + iconSize: L.point(expectedXY, expectedXY) + }); + + var marker = new L.Marker([0, 0], {icon: sizedIcon}); + map.addLayer(marker); + + var icon = marker._icon; + + expect(icon.style.width).to.be(expectedXY + 'px'); + expect(icon.style.height).to.be(expectedXY + 'px'); + }); + it("changes the icon to another image", function () { var marker = new L.Marker([0, 0], {icon: icon1}); map.addLayer(marker); diff --git a/src/layer/marker/Icon.js b/src/layer/marker/Icon.js index 036beebc..4f65fd2b 100644 --- a/src/layer/marker/Icon.js +++ b/src/layer/marker/Icon.js @@ -103,7 +103,7 @@ L.Icon = L.Class.extend({ var options = this.options; var sizeOption = options[name + 'Size']; - if (!L.Util.isArray(sizeOption)) { + if (typeof sizeOption === 'number') { sizeOption = [sizeOption, sizeOption]; }