]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/scriptaculous/unittest.js
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-includes / js / scriptaculous / unittest.js
index 07ec33fea30251081cbe18cce2d8c9217736d8e4..13473a30f4a21bfac09b1780e5eaf1ce17c63458 100644 (file)
@@ -1,4 +1,4 @@
-// script.aculo.us unittest.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
+// script.aculo.us unittest.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
 
 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
 //           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
@@ -121,7 +121,7 @@ Test.Unit.Logger.prototype = {
     this.loglines = $('loglines');
   },
   _toHTML: function(txt) {
-    return txt.escapeHTML().replace(/\n/g,"<br />");
+    return txt.escapeHTML().replace(/\n/g,"<br/>");
   },
   addLinksToResults: function(){ 
     $$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
@@ -524,15 +524,19 @@ Test.setupBDDExtensionMethods = function(){
     shouldNotBe:     'assertReturnsFalse',
     shouldRespondTo: 'assertRespondsTo'
   };
-  Test.BDDMethods = {};
-  for(m in METHODMAP) {
-    Test.BDDMethods[m] = eval(
-      'function(){'+
-      'var args = $A(arguments);'+
-      'var scope = args.shift();'+
-      'scope.'+METHODMAP[m]+'.apply(scope,(args || []).concat([this])); }');
+  var makeAssertion = function(assertion, args, object) { 
+       this[assertion].apply(this,(args || []).concat([object]));
   }
-  [Array.prototype, String.prototype, Number.prototype].each(
+  
+  Test.BDDMethods = {};   
+  $H(METHODMAP).each(function(pair) { 
+    Test.BDDMethods[pair.key] = function() { 
+       var args = $A(arguments); 
+       var scope = args.shift(); 
+       makeAssertion.apply(scope, [pair.value, args, this]); }; 
+  });
+  
+  [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
     function(p){ Object.extend(p, Test.BDDMethods) }
   );
 }