From b905708f24ac2367bc303e0dcdc8ae4804425843 Mon Sep 17 00:00:00 2001 From: danzel Date: Sun, 3 Feb 2013 15:34:32 +1300 Subject: [PATCH] Test cases for #1297 circleMarker setRadius issue. --- spec/runner.html | 1 + spec/suites/layer/marker/CircleMarkerSpec.js | 41 ++++++++++++++++++++ spec/testacular.conf.js | 1 + 3 files changed, 43 insertions(+) create mode 100644 spec/suites/layer/marker/CircleMarkerSpec.js diff --git a/spec/runner.html b/spec/runner.html index cd1a309d..1379f03e 100644 --- a/spec/runner.html +++ b/spec/runner.html @@ -44,6 +44,7 @@ + diff --git a/spec/suites/layer/marker/CircleMarkerSpec.js b/spec/suites/layer/marker/CircleMarkerSpec.js new file mode 100644 index 00000000..73099188 --- /dev/null +++ b/spec/suites/layer/marker/CircleMarkerSpec.js @@ -0,0 +1,41 @@ +describe('CircleMarker', function() { + describe("#_radius", function() { + var map; + beforeEach(function() { + map = L.map(document.createElement('div')); + }); + describe("when a CircleMarker is added to the map ", function() { + describe("with a radius set as an option", function() { + it("should take that radius", function() { + map.setView([0, 0], 1); + + var marker = L.circleMarker([0, 0], { radius: 20 }).addTo(map); + + expect(marker._radius).toBe(20); + }); + }); + + describe("and radius is set before adding it", function () { + it("should take that radius", function () { + map.setView([0, 0], 1); + + var marker = L.circleMarker([0, 0], { radius: 20 }); + marker.setRadius(15); + marker.addTo(map); + expect(marker._radius).toBe(15); + }); + }); + + describe("and radius is set after adding it", function () { + it("should take that radius", function () { + map.setView([0, 0], 1); + + var marker = L.circleMarker([0, 0], { radius: 20 }); + marker.addTo(map); + marker.setRadius(15); + expect(marker._radius).toBe(15); + }); + }); + }); + }); +}); \ No newline at end of file diff --git a/spec/testacular.conf.js b/spec/testacular.conf.js index 9137f4d9..f8665cba 100644 --- a/spec/testacular.conf.js +++ b/spec/testacular.conf.js @@ -33,6 +33,7 @@ files = [].concat([ "suites/dom/DomEventSpec.js", "suites/dom/DomUtilSpec.js", "suites/layer/TileLayerSpec.js", + "suites/layer/marker/CircleMarkerSpec.js", "suites/layer/vector/PolylineGeometrySpec.js", "suites/layer/vector/CircleSpec.js", "suites/map/MapSpec.js"