Ticket #103: 103.3.patch
| File 103.3.patch, 3.2 kB (added by crschmidt, 10 months ago) |
|---|
-
tests/Control/test_Attribution.html
old new 10 10 t.ok( control instanceof OpenLayers.Control.Attribution, "new OpenLayers.Control returns object" ); 11 11 t.eq( control.displayClass, "olControlAttribution", "displayClass is correct" ); 12 12 } 13 function test_Control_Attribution_setBaseLayer (t) { 14 t.plan(1); 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"); 21 22 } 13 23 function test_Control_Attribution_draw (t) { 14 24 t.plan(3); 15 25 control = new OpenLayers.Control.Attribution(); … … 19 29 t.eq(control.div.innerHTML, 'My layer!', "Attribution correct with one layer."); 20 30 map.addLayer(new OpenLayers.Layer("name", {'attribution':'My layer 2!'})); 21 31 t.eq(control.div.innerHTML, 'My layer!, My layer 2!', "Attribution correct with two layers."); 22 control.sep erator = '|';32 control.separator = '|'; 23 33 map.addLayer(new OpenLayers.Layer("name",{'attribution':'My layer 3!'})); 24 34 t.eq(control.div.innerHTML, 'My layer!|My layer 2!|My layer 3!', "Attribution correct with three layers and diff seperator."); 35 36 25 37 } 26 38 // --> 27 39 </script> -
lib/OpenLayers/Control/Attribution.js
old new 16 16 * APIProperty: seperator 17 17 * {String} String used to seperate layers. 18 18 */ 19 sep erator: ", ",19 separator: ", ", 20 20 21 21 /** 22 22 * Constructor: OpenLayers.Control.Attribution … … 36 36 this.map.events.unregister("removelayer", this, this.updateAttribution); 37 37 this.map.events.unregister("addlayer", this, this.updateAttribution); 38 38 this.map.events.unregister("changelayer", this, this.updateAttribution); 39 this.map.events.unregister("changebaselayer", this, this.updateAttribution); 39 40 40 41 OpenLayers.Control.prototype.destroy.apply(this, arguments); 41 42 }, … … 50 51 draw: function() { 51 52 OpenLayers.Control.prototype.draw.apply(this, arguments); 52 53 54 this.map.events.register('changebaselayer', this, this.updateAttribution); 53 55 this.map.events.register('changelayer', this, this.updateAttribution); 54 56 this.map.events.register('addlayer', this, this.updateAttribution); 55 57 this.map.events.register('removelayer', this, this.updateAttribution); … … 70 72 attributions.push( layer.attribution ); 71 73 } 72 74 } 73 this.div.innerHTML = attributions.join(this.sep erator);75 this.div.innerHTML = attributions.join(this.separator); 74 76 }, 75 77 76 78 /** @final @type String */
