Skip to content

Commit

Permalink
deprecated LayerSwitcher roundedCorner option
Browse files Browse the repository at this point in the history
  • Loading branch information
elemoine committed Dec 8, 2011
1 parent a8be54b commit 513dd16
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
14 changes: 11 additions & 3 deletions lib/OpenLayers/Control/LayerSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* @requires OpenLayers/Control.js
* @requires OpenLayers/Lang.js
* @requires Rico/Corner.js
* @requires OpenLayers/Console.js
*/

/**
Expand All @@ -28,9 +28,13 @@ OpenLayers.Control.LayerSwitcher =
/**
* APIProperty: roundedCorner
* {Boolean} If true the Rico library is used for rounding the corners
* of the layer switcher div, defaults to true.
* of the layer switcher div, defaults to false. *Deprecated*. Use
* CSS3's border-radius instead. If this option is set to true the
* Rico/Corner.js script must be loaded in the page, and therefore
* listed in the build profile.
*
*/
roundedCorner: true,
roundedCorner: false,

/**
* APIProperty: roundedCornerColor
Expand Down Expand Up @@ -115,6 +119,10 @@ OpenLayers.Control.LayerSwitcher =
initialize: function(options) {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.layerStates = [];

if(this.roundedCorner) {
OpenLayers.Console.warn('roundedCorner option is deprecated');
}
},

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/Control/LayerSwitcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
}

}
function test_Control_LayerSwitcher_ascendingw (t) {
function test_Control_LayerSwitcher_ascending (t) {

t.plan( 4 );

Expand All @@ -158,10 +158,10 @@
map.addControl(control);
control2 = new OpenLayers.Control.LayerSwitcher({'ascending':false});
map.addControl(control2);
t.ok(control.div.childNodes[1].childNodes[0].innerHTML.match("Base Layer"), "Base Layers first in LayerSwitcher with ascending true");
t.ok(control.div.childNodes[1].childNodes[2].innerHTML.match("Overlays"), "Overlays in LayerSwitcher with ascending true");
t.ok(control2.div.childNodes[1].childNodes[2].innerHTML.match("Base Layer"), "Base Layers last in LayerSwitcher with ascending false");
t.ok(control2.div.childNodes[1].childNodes[0].innerHTML.match("Overlays"), "Base Layers last in LayerSwitcher with ascending false");
t.ok(control.div.childNodes[0].childNodes[0].innerHTML.match("Base Layer"), "Base Layers first in LayerSwitcher with ascending true");
t.ok(control.div.childNodes[0].childNodes[2].innerHTML.match("Overlays"), "Overlays in LayerSwitcher with ascending true");
t.ok(control2.div.childNodes[0].childNodes[2].innerHTML.match("Base Layer"), "Base Layers last in LayerSwitcher with ascending false");
t.ok(control2.div.childNodes[0].childNodes[0].innerHTML.match("Overlays"), "Base Layers last in LayerSwitcher with ascending false");
}

function test_Control_LayerSwitcher_displayInLayerSwitcher (t) {
Expand All @@ -176,7 +176,7 @@

control = new OpenLayers.Control.LayerSwitcher();
map.addControl(control);
t.eq(control.div.childNodes[1].childNodes[0].style.display, "none" , "Base layer display off when no visble base layer");
t.eq(control.div.childNodes[0].childNodes[0].style.display, "none" , "Base layer display off when no visble base layer");

map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS("WMS",
Expand All @@ -186,7 +186,7 @@

control = new OpenLayers.Control.LayerSwitcher();
map.addControl(control);
t.eq(control.div.childNodes[1].childNodes[0].style.display, "" , "Base layer display on when visble base layer");
t.eq(control.div.childNodes[0].childNodes[0].style.display, "" , "Base layer display on when visble base layer");
}


Expand Down

0 comments on commit 513dd16

Please sign in to comment.