3 test("toggle(Function, Function) - add toggle event and fake a few clicks", function() {
6 fn1 = function() { count++; },
7 fn2 = function() { count--; },
9 link.click().toggle(fn1, fn2).click().click().click().click().click();
10 ok( count == 1, "Check for toggle(fn, fn)" );
13 test("unbind(event)", function() {
15 var el = $("#firstp");
17 ok( true, "Fake normal bind" );
19 el.click(function(event) {
21 ok( true, "Fake onebind" );
26 test("trigger(event, [data]", function() {
28 var handler = function(event, a, b, c) {
29 ok( a == 1, "check passed data" );
30 ok( b == "2", "check passed data" );
31 ok( c == "abc", "check passed data" );
33 $("#firstp").bind("click", handler).trigger("click", [1, "2", "abc"]);
36 test("bind() with data", function() {
38 var handler = function(event) {
39 ok( event.data, "check passed data exists" );
40 ok( event.data.foo == "bar", "Check value of passed data" );
42 $("#firstp").bind("click", {foo: "bar"}, handler).click();
45 test("bind() with data and trigger() with data", function() {
47 var handler = function(event, data) {
48 ok( event.data, "check passed data exists" );
49 ok( event.data.foo == "bar", "Check value of passed data" );
50 ok( data, "Check trigger data" );
51 ok( data.bar == "foo", "Check value of trigger data" );
53 $("#firstp").bind("click", {foo: "bar"}, handler).trigger("click", [{bar: "foo"}]);