# Code coverage report for ./suites/layer/FeatureGroupSpec.js

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

All files » ./suites/layer/ » FeatureGroupSpec.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
    371
    1
    1
    1
    1
    1
    1

    1
    1
    1

    1
    1

    1
    1
    1
    1
    1

    1
    1
    1
    1

    1

    1

     ﻿describe('CircleMarker', function () {
    	describe("#_propagateEvent", function () {
    		var map, marker;
    		beforeEach(function () {
    			map = L.map(document.createElement('div'));
    			map.setView([0, 0], 1);
    			marker = L.marker([0, 0]);
    		});
    		describe("when a Marker is added to multiple FeatureGroups ", function () {
    			it("e.layer should be the Marker", function () {
    				var fg1 = L.featureGroup(),
    				    fg2 = L.featureGroup();

    				fg1.addLayer(marker);
    				fg2.addLayer(marker);

    				var wasClicked = 0;
    				fg2.on('click', function(e) {
    					expect(e.layer).to.be(marker);
    					expect(e.target).to.be(fg2);
    					wasClicked |= 1;
    				});

    				fg1.on('click', function (e) {
    					expect(e.layer).to.be(marker);
    					expect(e.target).to.be(fg1);
    					wasClicked |= 2;
    				});

    				marker.fire('click', { type: 'click' });

    				expect(wasClicked).to.be(3);
    			});
    		});
    	});
    });