test("toggle(Function, Function) - add toggle event and fake a few clicks", function() {
expect(1);
var count = 0,
- fn1 = function() { count++; },
- fn2 = function() { count--; },
+ fn1 = function(e) { count++; },
+ fn2 = function(e) { count--; },
+ preventDefault = function(e) { e.preventDefault() },
link = $('#mark');
- link.click().toggle(fn1, fn2).click().click().click().click().click();
+ if ( $.browser.msie || $.browser.opera || /konquerer/i.test(navigator.userAgent) )
+ ok( false, "click() on link gets executed in IE/Opera/Konquerer, not intended behaviour!" );
+ else
+ link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
ok( count == 1, "Check for toggle(fn, fn)" );
});
test("unbind(event)", function() {
- expect(3);
+ expect(4);
var el = $("#firstp");
el.click(function() {
ok( true, "Fake normal bind" );
ok( true, "Fake onebind" );
});
el.click().click();
+
+ el.click(function() { return; });
+ el.unbind('click');
+ ok( !el[0].onclick, "Handler is removed" ); // Bug #964
});
test("trigger(event, [data]", function() {