git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Back out one of the changes from the previous commit that wasn't necessary to fix...
[jquery.git]
/
test
/
unit
/
event.js
diff --git
a/test/unit/event.js
b/test/unit/event.js
index
334f286
..
47da9b6
100644
(file)
--- a/
test/unit/event.js
+++ b/
test/unit/event.js
@@
-8,8
+8,8
@@
test("bind()", function() {
ok( event.data.foo == "bar", "bind() with data, Check value of passed data" );
};
$("#firstp").bind("click", {foo: "bar"}, handler).click().unbind("click", handler);
ok( event.data.foo == "bar", "bind() with data, Check value of passed data" );
};
$("#firstp").bind("click", {foo: "bar"}, handler).click().unbind("click", handler);
-
- ok( !$("#firstp").get(0).$events, "Event handler unbound when using data." );
+
+ ok( !jQuery.data($("#firstp")[0], "events"), "Event handler unbound when using data." );
reset();
var handler = function(event, data) {
reset();
var handler = function(event, data) {
@@
-108,11
+108,11
@@
test("unbind(event)", function() {
el.click(function() { return; });
el.unbind('change',function(){ return; });
el.click(function() { return; });
el.unbind('change',function(){ return; });
- for (var ret in el[0].$events['click']) break;
+ for (var ret in jQuery.data(el[0], "events")['click']) break;
ok( ret, "Extra handlers weren't accidentally removed." );
el.unbind('click');
ok( ret, "Extra handlers weren't accidentally removed." );
el.unbind('click');
- ok( !el[0].$events, "Removed the events expando after all handlers are unbound." );
+ ok( !jQuery.data(el[0], "events"), "Removed the events expando after all handlers are unbound." );
});
test("trigger(event, [data], [fn])", function() {
});
test("trigger(event, [data], [fn])", function() {
@@
-160,19
+160,19
@@
test("trigger(event, [data], [fn])", function() {
equals( $("#firstp").triggerHandler("click", [1, "2", "abc"], handler2), "test", "Verify handler response" );
// Build fake click event to pass in
equals( $("#firstp").triggerHandler("click", [1, "2", "abc"], handler2), "test", "Verify handler response" );
// Build fake click event to pass in
- var eventObj = jQuery.event.fix({ type: "click", target: document.body });
+ var eventObj = jQuery.event.fix({ type: "foo", target: document.body });
// Trigger only the handlers (no native), with external event obj
// Triggers 5
// Trigger only the handlers (no native), with external event obj
// Triggers 5
- equals( $("#firstp").triggerHandler("foo", [eventObj, 1, "2", "abc"]), "test", "Verify handler response" );
+ equals( $("#firstp").triggerHandler("click", [eventObj, 1, "2", "abc"]), "test", "Verify handler response" );
// Trigger only the handlers (no native) and extra fn, with external event obj
// Triggers 9
// Trigger only the handlers (no native) and extra fn, with external event obj
// Triggers 9
- equals( $("#firstp").triggerHandler("foo", [eventObj, 1, "2", "abc"], handler), "test", "Verify handler response" );
+ equals( $("#firstp").triggerHandler("click", [eventObj, 1, "2", "abc"], handler), "test", "Verify handler response" );
});
test("toggle(Function, Function)", function() {
});
test("toggle(Function, Function)", function() {
- expect(4);
+ expect(5);
var count = 0,
fn1 = function(e) { count++; },
fn2 = function(e) { count--; },
var count = 0,
fn1 = function(e) { count++; },
fn2 = function(e) { count--; },
@@
-180,7
+180,11
@@
test("toggle(Function, Function)", function() {
link = $('#mark');
link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
ok( count == 1, "Check for toggle(fn, fn)" );
link = $('#mark');
link.click(preventDefault).click().toggle(fn1, fn2).click().click().click().click().click();
ok( count == 1, "Check for toggle(fn, fn)" );
-
+
+ $("#firstp").toggle(function () {
+ equals(arguments.length, 4, "toggle correctly passes through additional triggered arguments, see #1701" )
+ }, function() {}).trigger("click", [ 1, 2, 3 ]);
+
var first = 0;
$("#simon1").one("click", function() {
ok( true, "Execute event only once" );
var first = 0;
$("#simon1").one("click", function() {
ok( true, "Execute event only once" );