Merge branch 'master' of github.com:jquery/jquery into 1.7/callbacks

Conflicts:
	test/index.html
This commit is contained in:
jaubourg 2011-05-24 00:45:37 +02:00
commit 1ed70e056d
25 changed files with 529 additions and 143 deletions

View file

@ -1,33 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<h3>jQuery Test boxModel detection in IE 6 & 7 compatMode="CSS1Compat"</h3>
<div>document.compatMode = <span id="compat-mode">?</span></div>
<div>jQuery.support.boxModel = <span id="box-model">?</span></div>
<script src="../src/core.js"></script>
<script src="../src/deferred.js"></script>
<script src="../src/support.js"></script>
<script src="../src/data.js"></script>
<script src="../src/queue.js"></script>
<script src="../src/attributes.js"></script>
<script src="../src/event.js"></script>
<script src="../src/sizzle/sizzle.js"></script>
<script src="../src/sizzle-jquery.js"></script>
<script src="../src/traversing.js"></script>
<script src="../src/manipulation.js"></script>
<script src="../src/css.js"></script>
<script src="../src/ajax.js"></script>
<script src="../src/ajax/jsonp.js"></script>
<script src="../src/ajax/script.js"></script>
<script src="../src/ajax/xhr.js"></script>
<script src="../src/effects.js"></script>
<script src="../src/offset.js"></script>
<script src="../src/dimensions.js"></script>
<script>
jQuery(function() {
jQuery( "#compat-mode" ).text( document.compatMode );
jQuery( "#box-model" ).text( jQuery.support.boxModel );
});
</script>
</body>
</html>

View file

@ -0,0 +1,37 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr" id="html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
background: #000000;
}
</style>
</head>
<body>
<div>
<script src="../../../src/core.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
</div>
<script>
window.top.supportCallback( jQuery( "body" ).css( "backgroundColor" ), jQuery.support );
</script>
</body>
</html>

View file

@ -0,0 +1,27 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<script src="../../../src/core.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
<script>
window.top.supportCallback( document.compatMode, jQuery.support.boxModel );
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<html>
<head>
<script src="../../../src/core.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/queue.js"></script>
<script src="../../../src/attributes.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/manipulation.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/ajax.js"></script>
<script src="../../../src/ajax/jsonp.js"></script>
<script src="../../../src/ajax/script.js"></script>
<script src="../../../src/ajax/xhr.js"></script>
<script src="../../../src/effects.js"></script>
<script src="../../../src/offset.js"></script>
<script src="../../../src/dimensions.js"></script>
</head>
<body>
</body>
</html>

View file

@ -182,11 +182,21 @@
<td id='submitSubmit' class="red">BUTTON</td>
<td id='boundSubmit' class="red">DOCUMENT</td>
</tr>
</table>
</table>
<h1>Mouseleave Tests</h1>
<div class="out" style="margin:20px; border:1px solid #000; background: red;">
<p>Count mouse leave event</p>
<div class="in" style="background: green; margin: 10px auto; width: 50%;">
<p>mouse over here should not trigger the counter.</p>
</div>
<p>0</p>
</div>
<ul id="log"></ul>
<script type='text/javascript'>
<script type='text/javascript'>
jQuery.fn.addChangeClickTest = function( id, prevent ) {
this.bind("focusin", function(){
jQuery(id + "focus").blink();
@ -270,6 +280,10 @@
jQuery("#boundSubmit").blink();
});
</script>
var n = 0;
$("div.out").live("mouseleave", function() {
$("p:last", this).text(++n);
});
</script>
</body>
</html>

View file

@ -35,6 +35,7 @@
<script src="data/testrunner.js"></script>
<script src="unit/core.js"></script>
<script src="unit/support.js"></script>
<script src="unit/callbacks.js"></script>
<script src="unit/deferred.js"></script>
<script src="unit/data.js"></script>

@ -1 +1 @@
Subproject commit 9887663380693009874e8c76f0bf77a921931766
Subproject commit d97b37ec322136406790e75d03333559f38bbecb

View file

@ -6,7 +6,7 @@ var functionReturningObj = function(value) { return (function() { return value;
test("jQuery.attrFix/jQuery.propFix integrity test", function() {
expect(2);
// This must be maintained and equal jQuery.attrFix when appropriate
// Ensure that accidental or erroneous property
// overwrites don't occur
@ -40,7 +40,7 @@ test("jQuery.attrFix/jQuery.propFix integrity test", function() {
});
test("attr(String)", function() {
expect(37);
expect(45);
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
@ -54,9 +54,10 @@ test("attr(String)", function() {
equals( jQuery("#text1").attr("name"), "action", "Check for name attribute" );
ok( jQuery("#form").attr("action").indexOf("formaction") >= 0, "Check for action attribute" );
equals( jQuery("#text1").attr("value", "t").attr("value"), "t", "Check setting the value attribute" );
equals( jQuery("<div value='t'></div>").attr("value"), "t", "Check setting custom attr named 'value' on a div" );
equals( jQuery("#form").attr("blah", "blah").attr("blah"), "blah", "Set non-existant attribute on a form" );
equals( jQuery("#foo").attr("height"), undefined, "Non existent height attribute should return undefined" );
// [7472] & [3113] (form contains an input with name="action" or name="id")
var extras = jQuery("<input name='id' name='name' /><input id='target' name='target' />").appendTo("#testForm");
equals( jQuery("#form").attr("action","newformaction").attr("action"), "newformaction", "Check that action attribute was changed" );
@ -66,7 +67,7 @@ test("attr(String)", function() {
// Bug #3685 (form contains input with name="name")
equals( jQuery("#testForm").attr("name"), undefined, "Retrieving name does not retrieve input with name=name" );
extras.remove();
equals( jQuery("#text1").attr("maxlength"), "30", "Check for maxlength attribute" );
equals( jQuery("#text1").attr("maxLength"), "30", "Check for maxLength attribute" );
equals( jQuery("#area1").attr("maxLength"), "30", "Check for maxLength attribute" );
@ -92,6 +93,12 @@ test("attr(String)", function() {
body.removeAttribute("foo"); // Cleanup
var select = document.createElement("select"), optgroup = document.createElement("optgroup"), option = document.createElement("option");
optgroup.appendChild( option );
select.appendChild( optgroup );
equal( jQuery( option ).attr("selected"), "selected", "Make sure that a single option is selected, even when in an optgroup." );
var $img = jQuery("<img style='display:none' width='215' height='53' src='http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif'/>").appendTo("body");
equals( $img.attr("width"), "215", "Retrieve width attribute an an element with display:none." );
equals( $img.attr("height"), "53", "Retrieve height attribute an an element with display:none." );
@ -109,17 +116,27 @@ test("attr(String)", function() {
equals( jQuery("#table").attr("test:attrib"), undefined, "Retrieving a non-existent attribute on a table with a colon does not throw an error." );
equals( jQuery("#table").attr("test:attrib", "foobar").attr("test:attrib"), "foobar", "Setting an attribute on a table with a colon does not throw an error." );
var $form = jQuery("<form class='something'></form>").appendTo("#qunit-fixture");
equal( $form.attr("class"), "something", "Retrieve the class attribute on a form." );
var $a = jQuery("<a href='#' onclick='something()'>Click</a>").appendTo("#qunit-fixture");
equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without anonymous function wrapper." );
ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." );
ok( jQuery("<div/>").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." );
equal( jQuery("<div/>").attr("title", "something").attr("title"), "something", "Set the title attribute." );
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
equal( jQuery("<div/>").attr("value"), undefined, "An unset value on a div returns undefined." );
equal( jQuery("<input/>").attr("value"), "", "An unset value on an input returns current value." );
});
if ( !isLocal ) {
test("attr(String) in XML Files", function() {
expect(2);
stop();
jQuery.get("data/dashboard.xml", function(xml) {
equals( jQuery("locations", xml).attr("class"), "foo", "Check class attribute in XML document" );
equals( jQuery("location", xml).attr("for"), "bar", "Check for attribute in XML document" );
jQuery.get("data/dashboard.xml", function( xml ) {
equals( jQuery( "locations", xml ).attr("class"), "foo", "Check class attribute in XML document" );
equals( jQuery( "location", xml ).attr("for"), "bar", "Check for attribute in XML document" );
start();
});
});
@ -144,7 +161,7 @@ test("attr(Hash)", function() {
});
test("attr(String, Object)", function() {
expect(59);
expect(69);
var div = jQuery("div").attr("foo", "bar"),
fail = false;
@ -193,6 +210,11 @@ test("attr(String, Object)", function() {
equals( jQuery("#check2").prop("checked"), false, "Set checked attribute" );
equals( jQuery("#check2").attr("checked"), undefined, "Set checked attribute" );
jQuery("#check2").attr("checked", "checked");
equal( document.getElementById("check2").checked, true, "Set checked attribute with 'checked'" );
equal( jQuery("#check2").prop("checked"), true, "Set checked attribute" );
equal( jQuery("#check2").attr("checked"), "checked", "Set checked attribute" );
jQuery("#text1").prop("readOnly", true);
equals( document.getElementById("text1").readOnly, true, "Set readonly attribute" );
equals( jQuery("#text1").prop("readOnly"), true, "Set readonly attribute" );
@ -206,9 +228,6 @@ test("attr(String, Object)", function() {
equals( document.getElementById("name").maxLength, 5, "Set maxlength attribute" );
jQuery("#name").attr("maxLength", "10");
equals( document.getElementById("name").maxLength, 10, "Set maxlength attribute" );
var $p = jQuery("#firstp").attr("nonexisting", "foo");
equals( $p.attr("nonexisting"), "foo", "attr(name, value) works correctly for non existing attributes (bug #7500).");
$p.removeAttr("nonexisting");
var $text = jQuery("#text1").attr("autofocus", true);
if ( "autofocus" in $text[0] ) {
@ -227,12 +246,19 @@ test("attr(String, Object)", function() {
var attributeNode = document.createAttribute("irrelevant"),
commentNode = document.createComment("some comment"),
textNode = document.createTextNode("some text");
jQuery.each( [commentNode, textNode, attributeNode], function( i, ele ) {
var $ele = jQuery( ele );
$ele.attr( "nonexisting", "foo" );
strictEqual( $ele.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
textNode = document.createTextNode("some text"),
obj = {};
jQuery.each( [commentNode, textNode, attributeNode], function( i, elem ) {
var $elem = jQuery( elem );
$elem.attr( "nonexisting", "foo" );
strictEqual( $elem.attr("nonexisting"), undefined, "attr(name, value) works correctly on comment and text nodes (bug #7500)." );
});
jQuery.each( [window, document, obj, "#firstp"], function( i, elem ) {
var $elem = jQuery( elem );
strictEqual( $elem.attr("nonexisting"), undefined, "attr works correctly for non existing attributes (bug #7500)." );
equal( $elem.attr("something", "foo" ).attr("something"), "foo", "attr falls back to prop on unsupported arguments" );
});
var table = jQuery("#table").append("<tr><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr><tr><td>cell</td><td>cell</td></tr>"),
@ -244,7 +270,7 @@ 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." );
equals( jQuery("#area1").attr("value"), "foobar", "Value attribute retrieves the property for backwards compatibility." );
// for #1070
jQuery("#name").attr("someAttr", "0");
@ -262,7 +288,7 @@ test("attr(String, Object)", function() {
j.removeAttr("name");
QUnit.reset();
// Type
var type = jQuery("#check2").attr("type");
var thrown = false;
@ -350,10 +376,10 @@ if ( !isLocal ) {
test("attr(String, Object) - Loaded via XML document", function() {
expect(2);
stop();
jQuery.get("data/dashboard.xml", function(xml) {
jQuery.get("data/dashboard.xml", function( xml ) {
var titles = [];
jQuery("tab", xml).each(function() {
titles.push(jQuery(this).attr("title"));
jQuery( "tab", xml ).each(function() {
titles.push( jQuery(this).attr("title") );
});
equals( titles[0], "Location", "attr() in XML context: Check first title" );
equals( titles[1], "Users", "attr() in XML context: Check second title" );
@ -424,7 +450,7 @@ test("removeAttr(String)", function() {
equals( jQuery("#foo").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute" );
equals( jQuery("#form").attr("style", "position:absolute;").removeAttr("style").attr("style"), undefined, "Check removing style attribute on a form" );
equals( jQuery("#fx-test-group").attr("height", "3px").removeAttr("height").css("height"), "1px", "Removing height attribute has no effect on height set with style attribute" );
jQuery("#check1").removeAttr("checked").prop("checked", true).removeAttr("checked");
equals( document.getElementById("check1").checked, false, "removeAttr sets boolean properties to false" );
jQuery("#text1").prop("readOnly", true).removeAttr("readonly");
@ -581,10 +607,34 @@ test("val()", function() {
var $button = jQuery("<button value='foobar'>text</button>").insertAfter("#button");
equals( $button.val(), "foobar", "Value retrieval on a button does not return innerHTML" );
equals( $button.val("baz").html(), "text", "Setting the value does not change innerHTML" );
equals( jQuery("<option/>").val("test").attr("value"), "test", "Setting value sets the value attribute" );
});
if ( "value" in document.createElement("meter") &&
"value" in document.createElement("progress") ) {
test("val() respects numbers without exception (Bug #9319)", function() {
expect(4);
var $meter = jQuery("<meter min='0' max='10' value='5.6'></meter>"),
$progress = jQuery("<progress max='10' value='1.5'></progress>");
try {
equal( typeof $meter.val(), "number", "meter, returns a number and does not throw exception" );
equal( $meter.val(), $meter[0].value, "meter, api matches host and does not throw exception" );
equal( typeof $progress.val(), "number", "progress, returns a number and does not throw exception" );
equal( $progress.val(), $progress[0].value, "progress, api matches host and does not throw exception" );
} catch(e) {}
$meter.remove();
$progress.remove();
});
}
var testVal = function(valueObj) {
expect(8);
@ -708,7 +758,7 @@ test("val(select) after form.reset() (Bug #2551)", function() {
same( jQuery("#select3").val(), ["1", "2"], "Call val() on a multiple=\"multiple\" select" );
jQuery("#kk").remove();
});
});
var testAddClass = function(valueObj) {
expect(5);
@ -752,7 +802,7 @@ test("addClass(Function) with incoming value", function() {
var div = jQuery("div"), old = div.map(function(){
return jQuery(this).attr("class") || "";
});
div.addClass(function(i, val) {
if ( this.id !== "_firebugConsole") {
equals( val, old[i], "Make sure the incoming value is correct." );

View file

@ -109,11 +109,13 @@ test("css(String|Hash)", function() {
});
test("css() explicit and relative values", function() {
expect(9);
expect(27);
var $elem = jQuery("#nothiddendiv");
$elem.css({ width: 1, height: 1 });
$elem.css({ width: 1, height: 1, paddingLeft: "1px", opacity: 1 });
equals( $elem.width(), 1, "Initial css set or width/height works (hash)" );
equals( $elem.css("paddingLeft"), "1px", "Initial css set of paddingLeft works (hash)" );
equals( $elem.css("opacity"), "1", "Initial css set of opacity works (hash)" );
$elem.css({ width: "+=9" });
equals( $elem.width(), 10, "'+=9' on width (hash)" );
@ -138,6 +140,54 @@ test("css() explicit and relative values", function() {
$elem.css( "width", "-=9px" );
equals( $elem.width(), 1, "'-=9px' on width (params)" );
$elem.css({ paddingLeft: "+=4" });
equals( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "-=4" });
equals( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "+=4px" });
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on paddingLeft (hash)" );
$elem.css({ paddingLeft: "-=4px" });
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on paddingLeft (hash)" );
$elem.css({ "padding-left": "+=4" });
equals( $elem.css("paddingLeft"), "5px", "'+=4' on padding-left (hash)" );
$elem.css({ "padding-left": "-=4" });
equals( $elem.css("paddingLeft"), "1px", "'-=4' on padding-left (hash)" );
$elem.css({ "padding-left": "+=4px" });
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (hash)" );
$elem.css({ "padding-left": "-=4px" });
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (hash)" );
$elem.css( "paddingLeft", "+=4" );
equals( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (params)" );
$elem.css( "paddingLeft", "-=4" );
equals( $elem.css("paddingLeft"), "1px", "'-=4' on paddingLeft (params)" );
$elem.css( "padding-left", "+=4px" );
equals( $elem.css("paddingLeft"), "5px", "'+=4px' on padding-left (params)" );
$elem.css( "padding-left", "-=4px" );
equals( $elem.css("paddingLeft"), "1px", "'-=4px' on padding-left (params)" );
$elem.css({ opacity: "-=0.5" });
equals( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (hash)" );
$elem.css({ opacity: "+=0.5" });
equals( $elem.css("opacity"), "1", "'+=0.5' on opacity (hash)" );
$elem.css( "opacity", "-=0.5" );
equals( $elem.css("opacity"), "0.5", "'-=0.5' on opacity (params)" );
$elem.css( "opacity", "+=0.5" );
equals( $elem.css("opacity"), "1", "'+=0.5' on opacity (params)" );
});
test("css(String, Object)", function() {

View file

@ -488,7 +488,7 @@ if (window.JSON && window.JSON.stringify) {
}
test("jQuery.data should follow html5 specification regarding camel casing", function() {
expect(6);
expect(8);
var div = jQuery("<div id='myObject' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
.prependTo("body");
@ -501,5 +501,10 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
equals(div.data("fooBar"), "b", "Verify multiple word data-* key");
equals(div.data("fooBarBaz"), "c", "Verify multiple word data-* key");
div.data("foo-bar", "d");
equals(div.data("fooBar"), "d", "Verify updated data-* key");
equals(div.data("foo-bar"), "d", "Verify updated data-* key");
div.remove();
});
});

16
test/unit/effects.js vendored
View file

@ -1029,3 +1029,19 @@ test( "animate properties missing px w/ opacity as last (#9074)", 2, function()
start();
}, 100);
});
test("callbacks should fire in correct order (#9100)", function() {
stop();
var a = 1,
cb = 0,
$lis = jQuery("<p data-operation='*2'></p><p data-operation='^2'></p>").appendTo("#qunit-fixture")
// The test will always pass if no properties are animated or if the duration is 0
.animate({fontSize: 12}, 13, function() {
a *= jQuery(this).data("operation") === "*2" ? 2 : a;
cb++;
if ( cb === 2 ) {
equal( a, 4, "test value has been *2 and _then_ ^2");
start();
}
});
});

View file

@ -14,6 +14,26 @@ test("null or undefined handler", function() {
} catch (e) {}
});
test("bind(),live(),delegate() with non-null,defined data", function() {
expect(3);
var handler = function( event, data ) {
equal( data, 0, "non-null, defined data (zero) is correctly passed" );
};
jQuery("#foo").bind("foo", handler);
jQuery("#foo").live("foo", handler);
jQuery("div").delegate("#foo", "foo", handler);
jQuery("#foo").trigger("foo", 0);
jQuery("#foo").unbind("foo", handler);
jQuery("#foo").die("foo", handler);
jQuery("div").undelegate("#foo", "foo");
});
test("bind(), with data", function() {
expect(4);
var handler = function(event) {

View file

@ -1044,7 +1044,7 @@ test("clone(form element) (Bug #3879, #6655)", function() {
equals( clone.is(":checked"), element.is(":checked"), "Checked input cloned correctly" );
equals( clone[0].defaultValue, "foo", "Checked input defaultValue cloned correctly" );
// defaultChecked also gets set now due to setAttribute in attr, is this check still valid?
// equals( clone[0].defaultChecked, !jQuery.support.noCloneChecked, "Checked input defaultChecked cloned correctly" );
@ -1393,6 +1393,41 @@ test("jQuery.buildFragment - no plain-text caching (Bug #6779)", function() {
}
catch(e) {}
}
equals($f.text(), bad.join(""), "Cached strings that match Object properties");
equals($f.text(), bad.join(""), "Cached strings that match Object properties");
$f.remove();
});
test( "jQuery.html - execute scripts escaped with html comment or CDATA (#9221)", function() {
expect( 3 );
jQuery( [
'<script type="text/javascript">',
'<!--',
'ok( true, "<!-- handled" );',
'//-->',
'</script>'
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
jQuery( [
'<script type="text/javascript">',
'<![CDATA[',
'ok( true, "<![CDATA[ handled" );',
'//]]>',
'</script>'
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
jQuery( [
'<script type="text/javascript">',
'<!--//--><![CDATA[//><!--',
'ok( true, "<!--//--><![CDATA[//><!-- (Drupal case) handled" );',
'//--><!]]>',
'</script>'
].join ( "\n" ) ).appendTo( "#qunit-fixture" );
});
test("jQuery.buildFragment - plain objects are not a document #8950", function() {
expect(1);
try {
jQuery('<input type="hidden">', {});
ok( true, "Does not allow attribute object to be treated like a doc object");
} catch (e) {}
});

View file

@ -107,7 +107,31 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
equals(counter, 2, "Deferreds resolved");
start();
});
});
test("callbacks keep their place in the queue", function() {
expect(5);
stop();
var div = jQuery("<div>"),
counter = 0;
div.queue(function( next ) {
equal( ++counter, 1, "Queue/callback order: first called" );
setTimeout( next, 200 );
}).show(100, function() {
equal( ++counter, 2, "Queue/callback order: second called" );
jQuery(this).hide(100, function() {
equal( ++counter, 4, "Queue/callback order: fourth called" );
});
}).queue(function( next ) {
equal( ++counter, 3, "Queue/callback order: third called" );
next();
});
div.promise("fx").done(function() {
equals(counter, 4, "Deferreds resolved");
start();
});
});
test("delay()", function() {

55
test/unit/support.js Normal file
View file

@ -0,0 +1,55 @@
module("support", { teardown: moduleTeardown });
function supportIFrameTest( title, url, noDisplay, func ) {
if ( noDisplay !== true ) {
func = noDisplay;
noDisplay = false;
}
test( title, function() {
var iframe;
stop();
window.supportCallback = function() {
var self = this,
args = arguments;
setTimeout( function() {
window.supportCallback = undefined;
iframe.remove();
func.apply( self, args );
start();
}, 0 );
};
iframe = jQuery( "<div/>" ).css( "display", noDisplay ? "none" : "block" ).append(
jQuery( "<iframe/>" ).attr( "src", "data/support/" + url + ".html" )
).appendTo( "body" );
});
}
supportIFrameTest( "proper boxModel in compatMode CSS1Compat (IE6 and IE7)", "boxModelIE", function( compatMode, boxModel ) {
ok( compatMode !== "CSS1Compat" || boxModel, "boxModel properly detected" );
});
supportIFrameTest( "body background is not lost if set prior to loading jQuery (#9238)", "bodyBackground", function( color, support ) {
expect( 2 );
var okValue = {
"#000000": true,
"rgb(0, 0, 0)": true
};
ok( okValue[ color ], "color was not reset (" + color + ")" );
var i, passed = true;
for ( i in jQuery.support ) {
if ( jQuery.support[ i ] !== support[ i ] ) {
passed = false;
strictEquals( jQuery.support[ i ], support[ i ], "Support property " + i + " is different" );
}
}
for ( i in support ) {
if ( !( i in jQuery.support ) ) {
ok = false;
strictEquals( src[ i ], dest[ i ], "Unexpected property: " + i );
}
}
ok( passed, "Same support properties" );
});