]> source.dussan.org Git - jquery.git/commitdiff
Testcase now logs exceptions if a console is avaiable, makes it easier to find bugs...
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 5 Sep 2006 15:05:56 +0000 (15:05 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 5 Sep 2006 15:05:56 +0000 (15:05 +0000)
build/test/js/test.js
src/event/event.js

index 82469f720f066e0bfb28d93a65175bf96b999ab1..1a47519ca232293978105a0d2d5575f03f27c5bd 100644 (file)
@@ -51,6 +51,8 @@ function runTest( files, num ) {
                        try {
                                eval(js);
                        } catch(e) {
+                               if(typeof console != "undefined") 
+                                       console.error(e);
                                Test.push( [ false, "Died on test #" + (Test.length+1) + ": " + e ] );
                        }
        
index bbf52a9e3b1be1d7c9dbc1c30d99bb08789a908d..eb5d731b6a6da783da2dd3350241cf97f9e8ffd3 100644 (file)
@@ -1443,6 +1443,48 @@ new function(){
                 * @type jQuery
                 * @cat Events/Mouse
                 */
+                
+                /**
+                 * @test var count;
+                 * var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
+                 *             "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + 
+                 *             "submit,keydown,keypress,keyup,error").split(",");
+                 * var handler1 = function(event) {
+                 *     count++;
+                 * };
+                 * var handler2 = function(event) {
+                 *     count++;
+                 * };
+                 * for( var i=0; i < e.length; i++) {
+                 *     var event = e[i];
+                 *     count = 0;
+                 *     // bind handler
+                 *     $(document)[event](handler1);
+                 *             $(document)[event](handler2);
+                 *     $(document)["one"+event](handler1);
+                 *     
+                 *     // call event two times
+                 *     $(document)[event]();
+                 *     $(document)[event]();
+                 *     
+                 *     // unbind events
+                 *     $(document)["un"+event](handler1);
+                 *     // call once more
+                 *     $(document)[event]();
+                 *
+                 *     // remove all handlers
+                 *             $(document)["un"+event]();
+                 *
+                 *     // call once more
+                 *     $(document)[event]();
+                 *     
+                 *     // assert count
+                 * @test ok( count == 6, 'Checking event ' + event);
+                 * }
+                 *
+                 * @private
+                 * @name eventTesting
+                 */
 
        var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
                "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +