Adding an option to avoid duplicate attribution.

Thanks Marc Jansen for this nice contribution.  Without wanting
to gush, I think this should be a model contribution because:

 1. it is a simple change
 2. with a nice example that clearly demonstrates the benefit
 3. it includes tests!
 4. and Marc wrote a note to the dev list with links to the ticket

r = me (closes #2266)



git-svn-id: http://svn.openlayers.org/trunk/openlayers@9720 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2009-10-06 18:46:06 +00:00
parent 11b38e5419
commit d1cecf3be1
3 changed files with 110 additions and 2 deletions

View File

@@ -35,6 +35,26 @@
}
function test_Control_Attribution_Propertry_eliminateDuplicates(t) {
t.plan(3);
control = new OpenLayers.Control.Attribution();
map = new OpenLayers.Map("map");
map.addControl(control);
map.addLayer(new OpenLayers.Layer("Company A: 1",{'attribution':'company A'}));
map.addLayer(new OpenLayers.Layer("Company A: 2",{'attribution':'company A'}));
t.eq(control.div.innerHTML, 'company A, company A', "Attribution correct with two layers and eliminateDuplicates = false.");
control.destroy();
control = new OpenLayers.Control.Attribution({eliminateDuplicates:true});
map.addControl(control);
t.eq(control.div.innerHTML, 'company A', "Attribution correct with two layers and eliminateDuplicates = true.");
map.addLayer(new OpenLayers.Layer("Company B: 1",{'attribution':'company B'}));
map.addLayer(new OpenLayers.Layer("Company A: 3",{'attribution':'company A'}));
t.eq(control.div.innerHTML, 'company A, company B', "Attribution correct with four layers (3 with same attribution) and eliminateDuplicates = true.");
}
</script>
</head>
<body>