Merge branch 'master' of github.com:jquery/jquery into 1.7/callbacks
This commit is contained in:
commit
0de05611bb
5 changed files with 112 additions and 58 deletions
|
@ -138,13 +138,13 @@ test("attr(Hash)", function() {
|
|||
if ( this.getAttribute("foo") != "baz" && this.getAttribute("zoo") != "ping" ) pass = false;
|
||||
});
|
||||
ok( pass, "Set Multiple Attributes" );
|
||||
equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" );
|
||||
equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
|
||||
equals( jQuery("#text1").attr({value: function() { return this.id; }})[0].value, "text1", "Set attribute to computed value #1" );
|
||||
equals( jQuery("#text1").attr({title: function(i) { return i; }}).attr("title"), "0", "Set attribute to computed value #2");
|
||||
|
||||
});
|
||||
|
||||
test("attr(String, Object)", function() {
|
||||
expect(57);
|
||||
expect(59);
|
||||
|
||||
var div = jQuery("div").attr("foo", "bar"),
|
||||
fail = false;
|
||||
|
@ -164,6 +164,8 @@ test("attr(String, Object)", function() {
|
|||
equals( jQuery("#name").attr("name"), "something", "Set name attribute" );
|
||||
jQuery("#name").attr("name", null);
|
||||
equals( jQuery("#name").attr("name"), undefined, "Remove name attribute" );
|
||||
var $input = jQuery("<input>", { name: "something" });
|
||||
equals( $input.attr("name"), "something", "Check element creation gets/sets the name attribute." );
|
||||
|
||||
jQuery("#check2").prop("checked", true).prop("checked", false).attr("checked", true);
|
||||
equals( document.getElementById("check2").checked, true, "Set checked attribute" );
|
||||
|
@ -209,7 +211,11 @@ test("attr(String, Object)", function() {
|
|||
$p.removeAttr("nonexisting");
|
||||
|
||||
var $text = jQuery("#text1").attr("autofocus", true);
|
||||
equals( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name");
|
||||
if ( "autofocus" in $text[0] ) {
|
||||
equals( $text.attr("autofocus"), "autofocus", "Set boolean attributes to the same name");
|
||||
} else {
|
||||
equals( $text.attr("autofocus"), undefined, "autofocus stays undefined in browsers that do not support it(F<4)");
|
||||
}
|
||||
equals( $text.attr("autofocus", false).attr("autofocus"), undefined, "Setting autofocus attribute to false removes it");
|
||||
equals( $text.attr("data-something", true).data("something"), true, "Setting data attributes are not affected by boolean settings");
|
||||
equals( $text.attr("data-another", false).data("another"), false, "Setting data attributes are not affected by boolean settings" );
|
||||
|
@ -238,6 +244,8 @@ test("attr(String, Object)", function() {
|
|||
table.attr("cellspacing", "2");
|
||||
equals( table[0].cellSpacing, "2", "Check cellspacing is correctly set" );
|
||||
|
||||
equals( jQuery("#area1").attr("value"), undefined, "Value attribute retrieved correctly on textarea." );
|
||||
|
||||
// for #1070
|
||||
jQuery("#name").attr("someAttr", "0");
|
||||
equals( jQuery("#name").attr("someAttr"), "0", "Set attribute to a string of \"0\"" );
|
||||
|
@ -500,7 +508,7 @@ test("removeProp(String)", function() {
|
|||
strictEqual( ele.nonexisting, undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." );
|
||||
});
|
||||
jQuery.each( [commentNode, textNode, attributeNode], function( i, ele ) {
|
||||
$ele = jQuery( ele );
|
||||
var $ele = jQuery( ele );
|
||||
$ele.prop( "nonexisting", "foo" ).removeProp( "nonexisting" );
|
||||
strictEqual( ele.nonexisting, undefined, "removeProp works correctly on non DOM element nodes (bug #7500)." );
|
||||
});
|
||||
|
|
76
test/unit/effects.js
vendored
76
test/unit/effects.js
vendored
|
@ -32,7 +32,8 @@ test("show()", function() {
|
|||
|
||||
hiddendiv.css("display","");
|
||||
|
||||
var pass = true, div = jQuery("#qunit-fixture div");
|
||||
var pass = true;
|
||||
div = jQuery("#qunit-fixture div");
|
||||
div.show().each(function(){
|
||||
if ( this.style.display == "none" ) pass = false;
|
||||
});
|
||||
|
@ -582,7 +583,7 @@ jQuery.checkOverflowDisplay = function(){
|
|||
equals(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");
|
||||
|
||||
start();
|
||||
}
|
||||
};
|
||||
|
||||
test( "jQuery.fx.prototype.cur()", 6, function() {
|
||||
var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css({
|
||||
|
@ -694,8 +695,8 @@ jQuery.each( {
|
|||
jQuery(elem).css(prop,prop == "opacity" ? 0 : "0px");
|
||||
return 0;
|
||||
}
|
||||
}, function(fn, f){
|
||||
jQuery.each( {
|
||||
}, function( fn, f ) {
|
||||
jQuery.each({
|
||||
"show": function(elem,prop){
|
||||
jQuery(elem).hide().addClass("wide"+prop);
|
||||
return "show";
|
||||
|
@ -901,7 +902,7 @@ jQuery.makeTest = function( text ){
|
|||
.after( elem );
|
||||
|
||||
return elem;
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.makeTest.id = 1;
|
||||
|
||||
|
@ -922,34 +923,42 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
|
|||
|
||||
test("animate with per-property easing", function(){
|
||||
|
||||
expect(3);
|
||||
expect(5);
|
||||
stop();
|
||||
|
||||
var _test1_called = false;
|
||||
var _test2_called = false;
|
||||
var _default_test_called = false;
|
||||
var data = { a:0, b:0, c:0 },
|
||||
_test1_called = false,
|
||||
_test2_called = false,
|
||||
_default_test_called = false,
|
||||
props = {
|
||||
a: [ 100, "_test1" ],
|
||||
b: [ 100, "_test2" ],
|
||||
c: 100
|
||||
};
|
||||
|
||||
jQuery.easing["_test1"] = function() {
|
||||
jQuery.easing["_test1"] = function(p) {
|
||||
_test1_called = true;
|
||||
return p;
|
||||
};
|
||||
|
||||
jQuery.easing["_test2"] = function() {
|
||||
jQuery.easing["_test2"] = function(p) {
|
||||
_test2_called = true;
|
||||
return p;
|
||||
};
|
||||
|
||||
jQuery.easing["_default_test"] = function() {
|
||||
jQuery.easing["_default_test"] = function(p) {
|
||||
_default_test_called = true;
|
||||
return p;
|
||||
};
|
||||
|
||||
jQuery({a:0,b:0,c:0}).animate({
|
||||
a: [100, "_test1"],
|
||||
b: [100, "_test2"],
|
||||
c: 100
|
||||
}, 400, "_default_test", function(){
|
||||
jQuery(data).animate( props, 400, "_default_test", function(){
|
||||
start();
|
||||
ok(_test1_called, "Easing function (1) called");
|
||||
ok(_test2_called, "Easing function (2) called");
|
||||
ok(_default_test_called, "Easing function (_default) called");
|
||||
|
||||
ok( _test1_called, "Easing function (_test1) called" );
|
||||
ok( _test2_called, "Easing function (_test2) called" );
|
||||
ok( _default_test_called, "Easing function (_default) called" );
|
||||
equal( props.a[ 1 ], "_test1", "animate does not change original props (per-property easing would be lost)");
|
||||
equal( props.b[ 1 ], "_test2", "animate does not change original props (per-property easing would be lost)");
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -993,3 +1002,30 @@ test("animate unit-less properties (#4966)", 2, function() {
|
|||
start();
|
||||
});
|
||||
});
|
||||
|
||||
test( "animate properties missing px w/ opacity as last (#9074)", 2, function() {
|
||||
expect( 6 );
|
||||
stop();
|
||||
var div = jQuery( "<div style='position: absolute; margin-left: 0; left: 0px;'></div>" )
|
||||
.appendTo( "#qunit-fixture" );
|
||||
function cssInt( prop ) {
|
||||
return parseInt( div.css( prop ), 10 );
|
||||
}
|
||||
equal( cssInt( "marginLeft" ), 0, "Margin left is 0" );
|
||||
equal( cssInt( "left" ), 0, "Left is 0" );
|
||||
div.animate({
|
||||
left: 200,
|
||||
marginLeft: 200,
|
||||
opacity: 0
|
||||
}, 1000);
|
||||
setTimeout(function() {
|
||||
var ml = cssInt( "marginLeft" ),
|
||||
l = cssInt( "left" );
|
||||
notEqual( ml, 0, "Margin left is not 0 after partial animate" );
|
||||
notEqual( ml, 200, "Margin left is not 200 after partial animate" );
|
||||
notEqual( l, 0, "Left is not 0 after partial animate" );
|
||||
notEqual( l, 200, "Left is not 200 after partial animate" );
|
||||
div.stop().remove();
|
||||
start();
|
||||
}, 100);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue