3 test("toggle(Function, Function) - add toggle event and fake a few clicks", function() {
6 fn1 = function(e) { count++; },
7 fn2 = function(e) { count--; },
8 preventDefault = function(e) { e.preventDefault() },
10 if ( $.browser.msie || $.browser.opera || /konquerer/i.test(navigator.userAgent) )
11 ok( false, "click() on link gets executed in IE/Opera/Konquerer, not intended behaviour!" );
13 link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
14 ok( count == 1, "Check for toggle(fn, fn)" );
17 test("unbind(event)", function() {
19 var el = $("#firstp");
21 ok( true, "Fake normal bind" );
23 el.click(function(event) {
25 ok( true, "Fake onebind" );
30 test("trigger(event, [data]", function() {
32 var handler = function(event, a, b, c) {
33 ok( a == 1, "check passed data" );
34 ok( b == "2", "check passed data" );
35 ok( c == "abc", "check passed data" );
37 $("#firstp").bind("click", handler).trigger("click", [1, "2", "abc"]);
40 test("bind() with data", function() {
42 var handler = function(event) {
43 ok( event.data, "check passed data exists" );
44 ok( event.data.foo == "bar", "Check value of passed data" );
46 $("#firstp").bind("click", {foo: "bar"}, handler).click();
49 test("bind() with data and trigger() with data", function() {
51 var handler = function(event, data) {
52 ok( event.data, "check passed data exists" );
53 ok( event.data.foo == "bar", "Check value of passed data" );
54 ok( data, "Check trigger data" );
55 ok( data.bar == "foo", "Check value of trigger data" );
57 $("#firstp").bind("click", {foo: "bar"}, handler).trigger("click", [{bar: "foo"}]);