});
test("live with change", function(){
+ expect(8);
+
var selectChange = 0, checkboxChange = 0;
var select = jQuery("select[name='S1']")
checkbox.trigger("change");
equals( checkboxChange, 1, "Change on checkbox." );
- // test before activate on radio
-
- // test blur/focus on textarea
- var textarea = jQuery("#area1"), textareaChange = 0, oldVal = textarea.val();
- textarea.live("change", function() {
- textareaChange++;
- });
-
- textarea.val(oldVal + "foo");
- textarea.trigger("change");
- equals( textareaChange, 1, "Change on textarea." );
-
- textarea.val(oldVal);
- textarea.die("change");
-
// test blur/focus on text
var text = jQuery("#name"), textChange = 0, oldTextVal = text.val();
text.live("change", function() {
textChange++;
});
- text.val(oldVal+"foo");
+ text.val(oldTextVal+"foo");
text.trigger("change");
equals( textChange, 1, "Change on text input." );
});
test("delegate with change", function(){
+ expect(8);
+
var selectChange = 0, checkboxChange = 0;
var select = jQuery("select[name='S1']");
checkbox.trigger("change");
equals( checkboxChange, 1, "Change on checkbox." );
- // test before activate on radio
-
- // test blur/focus on textarea
- var textarea = jQuery("#area1"), textareaChange = 0, oldVal = textarea.val();
- jQuery("#body").delegate("#area1", "change", function() {
- textareaChange++;
- });
-
- textarea.val(oldVal + "foo");
- textarea.trigger("change");
- equals( textareaChange, 1, "Change on textarea." );
-
- textarea.val(oldVal);
- jQuery("#body").undelegate("#area1", "change");
-
// test blur/focus on text
var text = jQuery("#name"), textChange = 0, oldTextVal = text.val();
jQuery("#body").delegate("#name", "change", function() {
textChange++;
});
- text.val(oldVal+"foo");
+ text.val(oldTextVal+"foo");
text.trigger("change");
equals( textChange, 1, "Change on text input." );