From 513dd16be33c3185da9576b9d64907b49bbbda97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Fri, 9 Dec 2011 00:10:29 +0100 Subject: [PATCH] deprecated LayerSwitcher roundedCorner option --- lib/OpenLayers/Control/LayerSwitcher.js | 14 +++++++++++--- tests/Control/LayerSwitcher.html | 14 +++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers/Control/LayerSwitcher.js b/lib/OpenLayers/Control/LayerSwitcher.js index 4186445688..8a6d3e324b 100644 --- a/lib/OpenLayers/Control/LayerSwitcher.js +++ b/lib/OpenLayers/Control/LayerSwitcher.js @@ -6,7 +6,7 @@ /** * @requires OpenLayers/Control.js * @requires OpenLayers/Lang.js - * @requires Rico/Corner.js + * @requires OpenLayers/Console.js */ /** @@ -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 @@ -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'); + } }, /** diff --git a/tests/Control/LayerSwitcher.html b/tests/Control/LayerSwitcher.html index 7b1e56859f..47895857d2 100644 --- a/tests/Control/LayerSwitcher.html +++ b/tests/Control/LayerSwitcher.html @@ -141,7 +141,7 @@ } } - function test_Control_LayerSwitcher_ascendingw (t) { + function test_Control_LayerSwitcher_ascending (t) { t.plan( 4 ); @@ -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) { @@ -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", @@ -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"); }