git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make sure that elements that have been removed also have their special events cleaned...
[jquery.git]
/
test
/
unit
/
event.js
diff --git
a/test/unit/event.js
b/test/unit/event.js
index
e85c4bd
..
7d66c9c
100644
(file)
--- a/
test/unit/event.js
+++ b/
test/unit/event.js
@@
-72,7
+72,7
@@
test("bind(), multiple events at once and namespaces", function() {
});
test("bind(), namespace with special add", function() {
});
test("bind(), namespace with special add", function() {
- expect(18);
+ expect(24);
var div = jQuery("<div/>").bind("test", function(e) {
ok( true, "Test event fired." );
var div = jQuery("<div/>").bind("test", function(e) {
ok( true, "Test event fired." );
@@
-87,7
+87,9
@@
test("bind(), namespace with special add", function() {
equals( e.target, div[0], "And that the target is correct." );
},
setup: function(){},
equals( e.target, div[0], "And that the target is correct." );
},
setup: function(){},
- teardown: function(){},
+ teardown: function(){
+ ok(true, "Teardown called.");
+ },
add: function( handleObj ) {
var handler = handleObj.handler;
handleObj.handler = function(e) {
add: function( handleObj ) {
var handler = handleObj.handler;
handleObj.handler = function(e) {
@@
-95,7
+97,9
@@
test("bind(), namespace with special add", function() {
handler.apply( this, arguments );
};
},
handler.apply( this, arguments );
};
},
- remove: function() {}
+ remove: function() {
+ ok(true, "Remove called.");
+ }
};
div.bind("test.a", {x: 1}, function(e) {
};
div.bind("test.a", {x: 1}, function(e) {
@@
-116,6
+120,18
@@
test("bind(), namespace with special add", function() {
// Should trigger 2
div.trigger("test.b");
// Should trigger 2
div.trigger("test.b");
+
+ // Should trigger 4
+ div.unbind("test");
+
+ div = jQuery("<div/>").bind("test", function(e) {
+ ok( true, "Test event fired." );
+ });
+
+ // Should trigger 2
+ div.appendTo("#main").remove();
+
+ delete jQuery.event.special.test;
});
test("bind(), no data", function() {
});
test("bind(), no data", function() {
@@
-755,7
+771,7
@@
test("toggle(Function, Function, ...)", function() {
});
test(".live()/.die()", function() {
});
test(".live()/.die()", function() {
- expect(65);
+ expect(66);
var submit = 0, div = 0, livea = 0, liveb = 0;
var submit = 0, div = 0, livea = 0, liveb = 0;
@@
-1020,6
+1036,14
@@
test(".live()/.die()", function() {
equals( livee, 1, "Click, deep selector." );
jQuery("#nothiddendiv div").die("click");
equals( livee, 1, "Click, deep selector." );
jQuery("#nothiddendiv div").die("click");
+
+ jQuery("#nothiddendiv div").live("blur", function(){
+ ok( true, "Live div trigger blur." );
+ });
+
+ jQuery("#nothiddendiv div").trigger("blur");
+
+ jQuery("#nothiddendiv div").die("blur");
});
test("die all bound events", function(){
});
test("die all bound events", function(){