# Code coverage report for ./suites/layer/vector/PolylineSpec.js

## Statements: 100% (26 / 26) Branches: 100% (0 / 0) Functions: 100% (7 / 7) Lines: 100% (26 / 26)

All files » ./suites/layer/vector/ » PolylineSpec.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    561

    1
    1
    1
    1
    1

    1
    1
    1

    1

    1

    1
    1

    1
    1
    1

    1

    1

    1

    1

    1
    1
    1

    1

    1

    1

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