[Commits] r858 - core/trunk/geoext/tests/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Sat May 23 00:16:27 CEST 2009


Author: tschaub
Date: 2009-05-23 00:16:27 +0200 (Sat, 23 May 2009)
New Revision: 858

Modified:
   core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
Log:
test cleanup in preparation for demonstration of problem

Modified: core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-05-22 21:54:15 UTC (rev 857)
+++ core/trunk/geoext/tests/lib/GeoExt/widgets/Popup.html	2009-05-22 22:16:27 UTC (rev 858)
@@ -9,26 +9,13 @@
 
     <script type="text/javascript">
 
-        function makeFeature() {
-           return new OpenLayers.Feature.Vector(
-              new OpenLayers.Geometry.Point(100,50),
-              {
-                  name : "My Feature"
-              }
-           )
-        }
-       
-        function createMap() {
+        function setupContext() {        
+
             var map = new OpenLayers.Map();
             var layer = new OpenLayers.Layer("test", {isBaseLayer: true});
             map.addLayer(layer);
-            return map;
-        }
 
-        function loadMapPanel() {
-            var map = createMap();
-
-            mapPanel = new GeoExt.MapPanel({
+            var mapPanel = new GeoExt.MapPanel({
                 // panel options
                 id: "map-panel",
                 title: "GeoExt MapPanel",
@@ -41,35 +28,34 @@
                 zoom: 4
             });
 
-            return mapPanel;
-        }
+            var feature = new OpenLayers.Feature.Vector(
+                new OpenLayers.Geometry.Point(100,50),
+                {name: "My Feature"}
+            );
 
-        function setupContext() {        
-            var mapPanel = loadMapPanel();
-            var feature = makeFeature();
-            var map = mapPanel.map;
-
             return {
-               feature : feature,
-               map : map,
-               mapPanel : mapPanel
+                feature: feature,
+                map: map,
+                mapPanel: mapPanel
             };      
         }
+        
+        function tearDown(context) {
+            context.feature.destroy();
+            context.map.destroy();
+            context.mapPanel.destroy();
+        }
 
-        function popup(feature){
-          pop = new GeoExt.Popup({
-            title: 'My Popup',
-            feature: feature,
-            width:200,
-            html: bogusMarkup,
-            collapsible: true
-          });
-
-          return pop;
+        function popup(feature) {
+            return new GeoExt.Popup({
+                title: 'My Popup',
+                feature: feature,
+                width: 200,
+                html: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
+                collapsible: true
+            });
         }
 
-        var bogusMarkup = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit."
-
         function test_addtomappanel(t) {
             t.plan(1);
 
@@ -80,8 +66,8 @@
             pop.addToMapPanel(context.mapPanel);
 
             t.ok(context.mapPanel.el.child("div." + pop.popupCls),"Map panel contains popup");
-
-            context.mapPanel.destroy();
+            
+            //tearDown(context);
         }
 
         function test_anchorPopup(t) {
@@ -89,7 +75,7 @@
 
             var context = setupContext();
 
-            var pop = popup(context.feature, context.mapPanel);
+            var pop = popup(context.feature);
 
             pop.addToMapPanel(context.mapPanel);
 
@@ -110,6 +96,8 @@
 
             action = "popup expand"
             pop.expand();
+            
+            //tearDown(context);
         }
 
 
@@ -152,6 +140,8 @@
             
             action = "popup collapse";
             pop.collapse();
+            
+            //tearDown(context);
 
         }
 
@@ -160,7 +150,7 @@
             t.plan(0);
 
             var context = setupContext();
-            var pop = popup(context.feature, context.mapPanel);
+            var pop = popup(context.feature);
             pop.addToMapPanel(context.mapPanel);
 
             pop.on({
@@ -180,6 +170,8 @@
             
             action = "popup collapse";
             pop.collapse();
+            
+            //tearDown(context);
         }
 
     </script>



More information about the Commits mailing list