[OpenLayers-Commits] r12214 - trunk/openlayers/tests/BaseTypes

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Aug 8 08:39:40 EDT 2011


Author: erilem
Date: 2011-08-08 05:39:39 -0700 (Mon, 08 Aug 2011)
New Revision: 12214

Modified:
   trunk/openlayers/tests/BaseTypes/Class.html
Log:
add a new Class test, to test the inheritance chain, no functional change

Modified: trunk/openlayers/tests/BaseTypes/Class.html
===================================================================
--- trunk/openlayers/tests/BaseTypes/Class.html	2011-08-08 08:19:06 UTC (rev 12213)
+++ trunk/openlayers/tests/BaseTypes/Class.html	2011-08-08 12:39:39 UTC (rev 12214)
@@ -162,6 +162,24 @@
              "inheritance doesn't mess with parents");
 
     }
+
+    function test_inheritance_chain(t) {
+        t.plan(1);
+        var A = new OpenLayers.Class({
+            initialize: function() {
+                this.a = 'foo';
+            }
+        });
+        var B = new OpenLayers.Class(A, {});
+        var C = new OpenLayers.Class(B, {
+            initialize: function() {
+                B.prototype.initialize.apply(this, arguments);
+                this.a = this.a + 'bar';
+            }
+        });
+        var c = new C;
+        t.eq(c.a, 'foobar', 'constructor at the root is called');
+    }
     
     // Remove this at 3.0
     function test_Class_backwards(t) {



More information about the Commits mailing list