Skip to content

Commit

Permalink
fix specs for polygon holes
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Dec 18, 2013
1 parent dc5151b commit 33e23a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion debug/vector/vector2.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

var path = L.polygon([
[route, [[50.5, 30.5], [50.5, 40], [40, 40]]],
[[20, 0], [20, 40], [0, 40]]
[[[20, 0], [20, 40], [0, 40]]]
], {renderer: canvas}).addTo(map).bindPopup('Hello Canvas');

var poly = L.polyline([
Expand Down
13 changes: 9 additions & 4 deletions spec/suites/layer/vector/PolygonSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ describe('Polygon', function () {

var polygon = new L.Polygon(originalLatLngs);

//getLatLngs() returns only external ring
expect(polygon.getLatLngs()).to.eql([L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])]);
// getLatLngs() returns both rings
expect(polygon.getLatLngs()).to.eql([
[L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])],
[L.latLng([2, 3]), L.latLng([2, 4]), L.latLng([3, 4])]
]);
});
});

Expand Down Expand Up @@ -68,8 +71,10 @@ describe('Polygon', function () {
var polygon = new L.Polygon([]);
polygon.setLatLngs(latLngs);

//getLatLngs() returns only external ring
expect(polygon.getLatLngs()).to.eql([L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])]);
expect(polygon.getLatLngs()).to.eql([
[L.latLng([0, 10]), L.latLng([10, 10]), L.latLng([10, 0])],
[L.latLng([2, 3]), L.latLng([2, 4]), L.latLng([3, 4])]
]);
});
});

Expand Down

0 comments on commit 33e23a6

Please sign in to comment.