merge with master and resolve more conflicts

This commit is contained in:
louisremi 2011-04-12 11:29:25 +02:00
commit a5604aedb7
19 changed files with 322 additions and 87 deletions

View file

@ -1,5 +1,5 @@
/* for testing opacity set in styles in IE */
ol#empty { opacity: 0; filter:Alpha(opacity=0); }
ol#empty { opacity: 0; filter:Alpha(opacity=0) progid:DXImageTransform.Microsoft.gradient(startColorStr='#ffff0000', EndColorStr='#ffffffff'); }
div#fx-tests h4 {
background: red;

View file

@ -818,7 +818,7 @@ test("jQuery.extend(Object, Object)", function() {
});
test("jQuery.each(Object,Function)", function() {
expect(13);
expect(14);
jQuery.each( [0,1,2], function(i, n){
equals( i, n, "Check array iteration" );
});
@ -850,6 +850,13 @@ test("jQuery.each(Object,Function)", function() {
f[i] = "baz";
});
equals( "baz", f.foo, "Loop over a function" );
var stylesheet_count = 0;
jQuery.each(document.styleSheets, function(i){
stylesheet_count++;
});
equals(stylesheet_count, 2, "should not throw an error in IE while looping over document.styleSheets and return proper amount");
});
test("jQuery.makeArray", function(){

View file

@ -1,7 +1,7 @@
module("css", { teardown: moduleTeardown });
test("css(String|Hash)", function() {
expect(41);
expect( 42 );
equals( jQuery("#main").css("display"), "block", "Check for css property \"display\"");
@ -58,6 +58,9 @@ test("css(String|Hash)", function() {
equals( jQuery("#empty").css("opacity"), "0", "Assert opacity is accessible via filter property set in stylesheet in IE" );
jQuery("#empty").css({ opacity: "1" });
equals( jQuery("#empty").css("opacity"), "1", "Assert opacity is taken from style attribute when set vs stylesheet in IE with filters" );
jQuery.support.opacity ?
ok(true, "Requires the same number of tests"):
ok( ~jQuery("#empty")[0].currentStyle.filter.indexOf("gradient"), "Assert setting opacity doesn't overwrite other filters of the stylesheet in IE" );
var div = jQuery("#nothiddendiv"), child = jQuery("#nothiddendivchild");
@ -375,5 +378,19 @@ test("marginRight computed style (bug #3333)", function() {
marginRight: 0
});
equals($div.css("marginRight"), "0px");
equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block");
});
test("jQuery.cssProps behavior, (bug #8402)", function() {
var div = jQuery( "<div>" ).appendTo(document.body).css({
position: "absolute",
top: 0,
left: 10
});
jQuery.cssProps.top = "left";
equal( div.css("top"), "10px", "the fixed property is used when accessing the computed style");
div.css("top", "100px");
equal( div[0].style.left, "100px", "the fixed property is used when setting the style");
// cleanup jQuery.cssProps
jQuery.cssProps.top = undefined;
});

View file

@ -807,7 +807,7 @@ jQuery.checkState = function(){
jQuery.removeData(this, "olddisplay", true);
start();
}
};
// Chaining Tests
test("Chain fadeOut fadeIn", function() {

View file

@ -2022,6 +2022,27 @@ test("delegate with submit", function() {
jQuery(document).undelegate();
});
test("undelegate() with only namespaces", function(){
expect(2);
var $delegate = jQuery("#liveHandlerOrder"),
count = 0;
$delegate.delegate("a", "click.ns", function(e) {
count++;
});
jQuery("a", $delegate).eq(0).trigger("click.ns");
equals( count, 1, "delegated click.ns");
$delegate.undelegate(".ns");
jQuery("a", $delegate).eq(1).trigger("click.ns");
equals( count, 1, "no more .ns after undelegate");
});
test("Non DOM element events", function() {
expect(1);

View file

@ -433,7 +433,33 @@ test("offsetParent", function(){
equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
});
function testoffset( name, fn ) {
test("fractions (see #7730 and #7885)", function() {
expect(2);
jQuery('body').append('<div id="fractions"/>');
var expected = { top: 1000, left: 1000 };
var div = jQuery('#fractions');
div.css({
position: 'absolute',
left: '1000.7432222px',
top: '1000.532325px',
width: 100,
height: 100
});
div.offset(expected);
var result = div.offset();
equals( result.top, expected.top, "Check top" );
equals( result.left, expected.left, "Check left" );
div.remove();
});
function testoffset(name, fn) {
test(name, function() {
// pause execution for now

View file

@ -1,10 +1,17 @@
module("queue", { teardown: moduleTeardown });
test("queue() with other types",function() {
expect(9);
expect(11);
var counter = 0;
var $div = jQuery({});
stop();
var $div = jQuery({}),
defer;
$div.promise("foo").done(function() {
equals( counter, 0, "Deferred for collection with no queue is automatically resolved" );
});
$div
.queue("foo",function(){
@ -22,6 +29,11 @@ test("queue() with other types",function() {
equals( ++counter, 4, "Dequeuing" );
});
defer = $div.promise("foo").done(function() {
equals( counter, 4, "Testing previous call to dequeue in deferred" );
start();
});
equals( $div.queue("foo").length, 4, "Testing queue length" );
$div.dequeue("foo");
@ -74,7 +86,7 @@ test("queue(name) passes in the next item in the queue as a parameter", function
});
test("queue() passes in the next item in the queue as a parameter to fx queues", function() {
expect(2);
expect(3);
stop();
var div = jQuery({});
@ -87,11 +99,15 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
}).queue(function(next) {
equals(++counter, 2, "Next was called");
next();
start();
}).queue("bar", function() {
equals(++counter, 3, "Other queues are not triggered by next()")
});
jQuery.when( div.promise("fx"), div ).done(function() {
equals(counter, 2, "Deferreds resolved");
start();
});
});
test("delay()", function() {
@ -110,7 +126,9 @@ test("delay()", function() {
});
test("clearQueue(name) clears the queue", function() {
expect(1);
expect(2);
stop()
var div = jQuery({});
var counter = 0;
@ -123,6 +141,11 @@ test("clearQueue(name) clears the queue", function() {
counter++;
});
div.promise("foo").done(function() {
ok( true, "dequeue resolves the deferred" );
start();
});
div.dequeue("foo");
equals(counter, 1, "the queue was cleared");
@ -146,3 +169,81 @@ test("clearQueue() clears the fx queue", function() {
div.removeData();
});
test("_mark() and _unmark()", function() {
expect(1);
var div = {},
$div = jQuery( div );
stop();
jQuery._mark( div, "foo" );
jQuery._mark( div, "foo" );
jQuery._unmark( div, "foo" );
jQuery._unmark( div, "foo" );
$div.promise( "foo" ).done(function() {
ok( true, "No more marks" );
start();
});
});
test("_mark() and _unmark() default to 'fx'", function() {
expect(1);
var div = {},
$div = jQuery( div );
stop();
jQuery._mark( div );
jQuery._mark( div );
jQuery._unmark( div, "fx" );
jQuery._unmark( div );
$div.promise().done(function() {
ok( true, "No more marks" );
start();
});
});
test("promise()", function() {
expect(1);
stop();
var objects = [];
jQuery.each( [{}, {}], function( i, div ) {
var $div = jQuery( div );
$div.queue(function( next ) {
setTimeout( function() {
if ( i ) {
next();
setTimeout( function() {
jQuery._unmark( div );
}, 20 );
} else {
jQuery._unmark( div );
setTimeout( function() {
next();
}, 20 );
}
}, 50 );
}).queue(function( next ) {
next();
});
jQuery._mark( div );
objects.push( $div );
});
jQuery.when.apply( jQuery, objects ).done(function() {
ok( true, "Deferred resolved" );
start();
});
jQuery.each( objects, function() {
this.dequeue();
});
});

View file

@ -72,7 +72,7 @@ test("is(String|undefined)", function() {
});
test("is(jQuery)", function() {
expect(24);
expect(23);
ok( jQuery("#form").is( jQuery("form") ), "Check for element: A form is a form" );
ok( !jQuery("#form").is( jQuery("div") ), "Check for element: A form is not a div" );
ok( jQuery("#mark").is( jQuery(".blog") ), "Check for class: Expected class 'blog'" );
@ -83,7 +83,6 @@ test("is(jQuery)", function() {
ok( !jQuery("#en").is( jQuery("[lang=\"de\"]") ), "Check for attribute: Expected attribute lang to be 'en', not 'de'" );
ok( jQuery("#text1").is( jQuery("[type=\"text\"]") ), "Check for attribute: Expected attribute type to be 'text'" );
ok( !jQuery("#text1").is( jQuery("[type=\"radio\"]") ), "Check for attribute: Expected attribute type to be 'text', not 'radio'" );
ok( jQuery("#text2").is( jQuery(":disabled") ), "Check for pseudoclass: Expected to be disabled" );
ok( !jQuery("#text1").is( jQuery(":disabled") ), "Check for pseudoclass: Expected not disabled" );
ok( jQuery("#radio2").is( jQuery(":checked") ), "Check for pseudoclass: Expected to be checked" );
ok( !jQuery("#radio1").is( jQuery(":checked") ), "Check for pseudoclass: Expected not checked" );