Sha256: 69450005adff6ba4f5d46d8056640995200d40de893d24048f3de90b1fd98672

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

describe('Polyline', function () {

	var c = document.createElement('div');
	c.style.width = '400px';
	c.style.height = '400px';
	var map = new L.Map(c);
	map.setView(new L.LatLng(55.8, 37.6), 6);

	describe("#initialize", function () {
		it("doesn't overwrite the given latlng array", function () {
			var originalLatLngs = [
				[1, 2],
				[3, 4]
			];
			var sourceLatLngs = originalLatLngs.slice();

			var polyline = new L.Polyline(sourceLatLngs);

			expect(sourceLatLngs).to.eql(originalLatLngs);
			expect(polyline._latlngs).to.not.eql(sourceLatLngs);
		});
	});

	describe("#setLatLngs", function () {
		it("doesn't overwrite the given latlng array", function () {
			var originalLatLngs = [
				[1, 2],
				[3, 4]
			];
			var sourceLatLngs = originalLatLngs.slice();

			var polyline = new L.Polyline(sourceLatLngs);

			polyline.setLatLngs(sourceLatLngs);

			expect(sourceLatLngs).to.eql(originalLatLngs);
		});
	});

	describe("#spliceLatLngs", function () {
		it("splices the internal latLngs", function () {
			var latLngs = [
				[1, 2],
				[3, 4],
				[5, 6]
			];

			var polyline = new L.Polyline(latLngs);

			polyline.spliceLatLngs(1, 1, [7, 8]);

			expect(polyline._latlngs).to.eql([L.latLng([1, 2]), L.latLng([7, 8]), L.latLng([5, 6])]);
		});
	});
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
leaflet-js-0.8.dev2 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js
leaflet-js-0.7.0.4 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js
leaflet-js-0.7.0.3 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js
leaflet-js-0.7.0.2 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js
leaflet-js-0.7.0.1 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js
leaflet-js-0.7.0 lib/leaflet/spec/suites/layer/vector/PolylineSpec.js