3
<script src="../../lib/OpenLayers.js"></script>
4
<script type="text/javascript">
6
function test_Control_Attribution_constructor (t) {
9
control = new OpenLayers.Control.Attribution();
10
t.ok( control instanceof OpenLayers.Control.Attribution, "new OpenLayers.Control returns object" );
11
t.eq( control.displayClass, "olControlAttribution", "displayClass is correct" );
13
function test_Control_Attribution_setBaseLayer (t) {
15
map = new OpenLayers.Map("map");
16
map.addControl(control);
17
map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer!', isBaseLayer: true}));
18
map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 2!', isBaseLayer: true}));
19
map.setBaseLayer(map.layers[1]);
20
t.eq(control.div.innerHTML, 'My layer 2!', "Attribution correct with changed base layer");
23
function test_Control_Attribution_draw (t) {
25
control = new OpenLayers.Control.Attribution();
26
map = new OpenLayers.Map("map");
27
map.addControl(control);
28
map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer!'}));
29
t.eq(control.div.innerHTML, 'My layer!', "Attribution correct with one layer.");
30
map.addLayer(new OpenLayers.Layer("name", {'attribution':'My layer 2!'}));
31
t.eq(control.div.innerHTML, 'My layer!, My layer 2!', "Attribution correct with two layers.");
32
control.separator = '|';
33
map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 3!'}));
34
t.eq(control.div.innerHTML, 'My layer!|My layer 2!|My layer 3!', "Attribution correct with three layers and diff seperator.");
41
<div id="map" style="width: 1024px; height: 512px;"/>