[Commits] r2102 - in core/trunk/geoext: lib/GeoExt/widgets tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Tue Apr 20 20:58:27 CEST 2010


Author: tschaub
Date: 2010-04-20 20:58:27 +0200 (Tue, 20 Apr 2010)
New Revision: 2102

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/VectorLegend.js
   core/trunk/geoext/tests/lib/GeoExt/widgets/VectorLegend.html
Log:
Updating the vector legend so update calls the same on the super.  r=ahocevar (closes #266)

Modified: core/trunk/geoext/lib/GeoExt/widgets/VectorLegend.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/VectorLegend.js	2010-04-20 17:25:46 UTC (rev 2101)
+++ core/trunk/geoext/lib/GeoExt/widgets/VectorLegend.js	2010-04-20 18:58:27 UTC (rev 2102)
@@ -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/trunk/geoext/tests/lib/GeoExt/widgets/VectorLegend.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/VectorLegend.html	2010-04-20 17:25:46 UTC (rev 2101)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/VectorLegend.html	2010-04-20 18:58:27 UTC (rev 2102)
@@ -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