More CircleMarker tests, move them where they should be.

This commit is contained in:
danzel 2013-02-04 09:49:37 +13:00
parent ded525fb06
commit 0390a86e7f
3 changed files with 22 additions and 10 deletions

View File

@ -44,9 +44,9 @@
<!-- /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/CircleSpec.js"></script> <script type="text/javascript" src="suites/layer/vector/CircleSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/CircleMarkerSpec.js"></script>
<script type="text/javascript" src="suites/layer/vector/PolylineGeometrySpec.js"></script>
<!-- /map --> <!-- /map -->
<script type="text/javascript" src="suites/map/MapSpec.js"></script> <script type="text/javascript" src="suites/map/MapSpec.js"></script>

View File

@ -3,12 +3,11 @@
var map; var map;
beforeEach(function() { beforeEach(function() {
map = L.map(document.createElement('div')); map = L.map(document.createElement('div'));
map.setView([0, 0], 1);
}); });
describe("when a CircleMarker is added to the map ", function() { describe("when a CircleMarker is added to the map ", function() {
describe("with a radius set as an option", function() { describe("with a radius set as an option", function() {
it("should take that radius", function() { it("should take that radius", function() {
map.setView([0, 0], 1);
var marker = L.circleMarker([0, 0], { radius: 20 }).addTo(map); var marker = L.circleMarker([0, 0], { radius: 20 }).addTo(map);
expect(marker._radius).toBe(20); expect(marker._radius).toBe(20);
@ -17,8 +16,6 @@
describe("and radius is set before adding it", function () { describe("and radius is set before adding it", function () {
it("should take that radius", function () { it("should take that radius", function () {
map.setView([0, 0], 1);
var marker = L.circleMarker([0, 0], { radius: 20 }); var marker = L.circleMarker([0, 0], { radius: 20 });
marker.setRadius(15); marker.setRadius(15);
marker.addTo(map); marker.addTo(map);
@ -28,14 +25,29 @@
describe("and radius is set after adding it", function () { describe("and radius is set after adding it", function () {
it("should take that radius", function () { it("should take that radius", function () {
map.setView([0, 0], 1);
var marker = L.circleMarker([0, 0], { radius: 20 }); var marker = L.circleMarker([0, 0], { radius: 20 });
marker.addTo(map); marker.addTo(map);
marker.setRadius(15); marker.setRadius(15);
expect(marker._radius).toBe(15); expect(marker._radius).toBe(15);
}); });
}); });
describe("and setStyle is used to change the radius after adding", function () {
it("should take the given radius", function() {
var marker = L.circleMarker([0, 0], { radius: 20 });
marker.addTo(map);
marker.setStyle({ radius: 15 });
expect(marker._radius).toBe(15);
});
});
describe("and setStyle is used to change the radius before adding", function () {
it("should take the given radius", function () {
var marker = L.circleMarker([0, 0], { radius: 20 });
marker.setStyle({ radius: 15 });
marker.addTo(map);
expect(marker._radius).toBe(15);
});
});
}); });
}); });
}); });

View File

@ -33,9 +33,9 @@ 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/CircleSpec.js", "suites/layer/vector/CircleSpec.js",
"suites/layer/vector/CircleMarkerSpec.js",
"suites/layer/vector/PolylineGeometrySpec.js",
"suites/map/MapSpec.js" "suites/map/MapSpec.js"
]); ]);