Leaflet/spec/suites/layer/vector/CircleMarkerSpec.js
John Firebaugh 01332ebead Omit "should" in spec descriptions
The rationale is this: the spec string describes the expected
behavior unconditionally. The code examples, on the other hand,
set up an expectation that is tested with the call to the expect
method. The code examples can violate the expectation, but the
spec string does not. The value of the spec string is as clearly
as possible describing the behavior. Including “should” in that
description adds no value. (From http://rubyspec.org/style_guide/)
2013-02-19 12:41:48 -08:00

53 lines
1.6 KiB
JavaScript

describe('CircleMarker', function() {
describe("#_radius", function() {
var map;
beforeEach(function() {
map = L.map(document.createElement('div'));
map.setView([0, 0], 1);
});
describe("when a CircleMarker is added to the map ", function() {
describe("with a radius set as an option", function() {
it("takes that radius", function() {
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("takes that radius", function () {
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("takes that radius", function () {
var marker = L.circleMarker([0, 0], { radius: 20 });
marker.addTo(map);
marker.setRadius(15);
expect(marker._radius).toBe(15);
});
});
describe("and setStyle is used to change the radius after adding", function () {
it("takes 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("takes the given radius", function () {
var marker = L.circleMarker([0, 0], { radius: 20 });
marker.setStyle({ radius: 15 });
marker.addTo(map);
expect(marker._radius).toBe(15);
});
});
});
});
});