Test cases for #1297 circleMarker setRadius issue.

This commit is contained in:
danzel 2013-02-03 15:34:32 +13:00
parent d1eb21850c
commit b905708f24
3 changed files with 43 additions and 0 deletions

View File

@ -44,6 +44,7 @@
<!-- /layer --> <!-- /layer -->
<script type="text/javascript" src="suites/layer/TileLayerSpec.js"></script> <script type="text/javascript" src="suites/layer/TileLayerSpec.js"></script>
<script type="text/javascript" src="suites/layer/marker/CircleMarkerSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script> <script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script> <script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script>

View File

@ -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);
});
});
});
});
});

View File

@ -33,6 +33,7 @@ files = [].concat([
"suites/dom/DomEventSpec.js", "suites/dom/DomEventSpec.js",
"suites/dom/DomUtilSpec.js", "suites/dom/DomUtilSpec.js",
"suites/layer/TileLayerSpec.js", "suites/layer/TileLayerSpec.js",
"suites/layer/marker/CircleMarkerSpec.js",
"suites/layer/vector/PolylineGeometrySpec.js", "suites/layer/vector/PolylineGeometrySpec.js",
"suites/layer/vector/CircleSpec.js", "suites/layer/vector/CircleSpec.js",
"suites/map/MapSpec.js" "suites/map/MapSpec.js"