Skip to content
Permalink
Browse files

Testcase now logs exceptions if a console is avaiable, makes it easie…

…r to find bugs; Added test for all base events
  • Loading branch information
jzaefferer committed Sep 5, 2006
1 parent e2d3c43 commit 00e6e81f94a1831ceef76b371f9c186b4097d91e
Showing with 44 additions and 0 deletions.
  1. +2 −0 build/test/js/test.js
  2. +42 −0 src/event/event.js
@@ -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 ] );
}

@@ -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," +

0 comments on commit 00e6e81

Please sign in to comment.
You can’t perform that action at this time.