added test for trigger inside new event closure

This commit is contained in:
John Bender 2010-11-29 23:47:38 -08:00
parent 524008f5f3
commit c20b589686

View file

@ -7,7 +7,13 @@
events = ("touchstart touchmove touchend orientationchange tap taphold " +
"swipe swipeleft swiperight scrollstart scrollstop").split( " " );
module(libName);
module(libName, {
teardown: function(){
$.each(events, function(i, name){
$("#main").unbind(name);
});
}
});
$.testHelper.excludeFileProtocol(function(){
test( "new events defined on the jquery object", function(){
@ -34,6 +40,16 @@
$('#main').trigger(events[0]);
});
test( "defined event functions trigger the event with no arguments", function(){
expect( 1 );
$('#main')[events[0]](function(){
ok(true);
});
$('#main')[events[0]]();
});
test( "defining event functions sets the attrFn to true", function(){
$.each(events, function(i, name){
ok($.attrFn[name]);