[Commits] r2122 - in core/branches/0.7/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Tue Apr 27 09:31:54 CEST 2010


Author: elemoine
Date: 2010-04-27 09:31:54 +0200 (Tue, 27 Apr 2010)
New Revision: 2122

Modified:
   core/branches/0.7/geoext/lib/GeoExt/widgets/VectorLegend.js
   core/branches/0.7/geoext/tests/lib/GeoExt/widgets/VectorLegend.html
Log:
pull up patch for ticket 266 (closes #266)

Modified: core/branches/0.7/geoext/lib/GeoExt/widgets/VectorLegend.js
===================================================================
--- core/branches/0.7/geoext/lib/GeoExt/widgets/VectorLegend.js	2010-04-27 07:31:30 UTC (rev 2121)
+++ core/branches/0.7/geoext/lib/GeoExt/widgets/VectorLegend.js	2010-04-27 07:31:54 UTC (rev 2122)
@@ -519,6 +519,7 @@
      *  Update rule titles and symbolizers.
      */
     update: function() {
+        GeoExt.VectorLegend.superclass.update.apply(this, arguments);
         if (this.symbolType && this.rules) {
             if (this.rulesContainer.items) {
                 var comp;

Modified: core/branches/0.7/geoext/tests/lib/GeoExt/widgets/VectorLegend.html
===================================================================
--- core/branches/0.7/geoext/tests/lib/GeoExt/widgets/VectorLegend.html	2010-04-27 07:31:30 UTC (rev 2121)
+++ core/branches/0.7/geoext/tests/lib/GeoExt/widgets/VectorLegend.html	2010-04-27 07:31:54 UTC (rev 2122)
@@ -82,7 +82,36 @@
         
     }
     
+    function test_update(t) {
+        
+        t.plan(2);
 
+        var map = new OpenLayers.Map();
+        var layer = new OpenLayers.Layer.Vector("old");
+        map.addLayer(layer);
+
+        var store = new GeoExt.data.LayerStore({map: map});
+        
+        var legend = new GeoExt.VectorLegend({
+            layerRecord: store.getAt(0),
+            renderTo: "legendpanel",
+            symbolType: "Point"
+        });
+        
+        // check title
+        t.eq(legend.getComponent(0).getEl().dom.innerHTML, "old", "correct legend title");
+
+        // change layer title
+        layer.setName("new");
+
+        // check title (only works if layer is added to a map)
+        t.eq(legend.getComponent(0).getEl().dom.innerHTML, "new", "correct new legend title");
+
+        legend.destroy();
+        map.destroy();
+    }
+    
+
     </script>
 </head><body>
     <div id="legendpanel"></div>



More information about the Commits mailing list