2013-11-08 05:54:33 +08:00
|
|
|
|
describe('CircleMarker', function () {
|
|
|
|
|
describe("#_radius", function () {
|
2013-02-03 10:34:32 +08:00
|
|
|
|
var map;
|
2013-11-08 05:54:33 +08:00
|
|
|
|
beforeEach(function () {
|
2013-02-03 10:34:32 +08:00
|
|
|
|
map = L.map(document.createElement('div'));
|
2013-02-04 04:49:37 +08:00
|
|
|
|
map.setView([0, 0], 1);
|
2013-02-03 10:34:32 +08:00
|
|
|
|
});
|
2013-11-08 05:54:33 +08:00
|
|
|
|
describe("when a CircleMarker is added to the map ", function () {
|
|
|
|
|
describe("with a radius set as an option", function () {
|
|
|
|
|
it("takes that radius", function () {
|
2013-02-03 10:34:32 +08:00
|
|
|
|
var marker = L.circleMarker([0, 0], { radius: 20 }).addTo(map);
|
|
|
|
|
|
2013-03-02 05:49:20 +08:00
|
|
|
|
expect(marker._radius).to.be(20);
|
2013-02-03 10:34:32 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("and radius is set before adding it", function () {
|
2013-02-20 04:41:48 +08:00
|
|
|
|
it("takes that radius", function () {
|
2013-02-03 10:34:32 +08:00
|
|
|
|
var marker = L.circleMarker([0, 0], { radius: 20 });
|
|
|
|
|
marker.setRadius(15);
|
|
|
|
|
marker.addTo(map);
|
2013-03-02 05:49:20 +08:00
|
|
|
|
expect(marker._radius).to.be(15);
|
2013-02-03 10:34:32 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
describe("and radius is set after adding it", function () {
|
2013-02-20 04:41:48 +08:00
|
|
|
|
it("takes that radius", function () {
|
2013-02-03 10:34:32 +08:00
|
|
|
|
var marker = L.circleMarker([0, 0], { radius: 20 });
|
|
|
|
|
marker.addTo(map);
|
|
|
|
|
marker.setRadius(15);
|
2013-03-02 05:49:20 +08:00
|
|
|
|
expect(marker._radius).to.be(15);
|
2013-02-03 10:34:32 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
2013-02-04 04:49:37 +08:00
|
|
|
|
|
|
|
|
|
describe("and setStyle is used to change the radius after adding", function () {
|
2013-11-08 05:54:33 +08:00
|
|
|
|
it("takes the given radius", function () {
|
2013-02-04 04:49:37 +08:00
|
|
|
|
var marker = L.circleMarker([0, 0], { radius: 20 });
|
|
|
|
|
marker.addTo(map);
|
|
|
|
|
marker.setStyle({ radius: 15 });
|
2013-03-02 05:49:20 +08:00
|
|
|
|
expect(marker._radius).to.be(15);
|
2013-02-04 04:49:37 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
describe("and setStyle is used to change the radius before adding", function () {
|
2013-02-20 04:41:48 +08:00
|
|
|
|
it("takes the given radius", function () {
|
2013-02-04 04:49:37 +08:00
|
|
|
|
var marker = L.circleMarker([0, 0], { radius: 20 });
|
|
|
|
|
marker.setStyle({ radius: 15 });
|
|
|
|
|
marker.addTo(map);
|
2013-03-02 05:49:20 +08:00
|
|
|
|
expect(marker._radius).to.be(15);
|
2013-02-04 04:49:37 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
2013-02-03 10:34:32 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
2013-03-02 05:49:20 +08:00
|
|
|
|
});
|