From 33e23a69e737d634d54e67b1ab73e15cebedd562 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 13 Dec 2013 12:41:55 -0500 Subject: [PATCH] fix specs for polygon holes --- debug/vector/vector2.html | 2 +- spec/suites/layer/vector/PolygonSpec.js | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/debug/vector/vector2.html b/debug/vector/vector2.html index e51dfd94..695d736c 100644 --- a/debug/vector/vector2.html +++ b/debug/vector/vector2.html @@ -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([ diff --git a/spec/suites/layer/vector/PolygonSpec.js b/spec/suites/layer/vector/PolygonSpec.js index 7014838f..07c0170f 100644 --- a/spec/suites/layer/vector/PolygonSpec.js +++ b/spec/suites/layer/vector/PolygonSpec.js @@ -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])] + ]); }); }); @@ -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])] + ]); }); });