Skip to content

Commit

Permalink
Tests: Disable/relax a few tests failing in Android 2.3
Browse files Browse the repository at this point in the history
(cherry-picked from 704de81)

Fixes gh-1785
  • Loading branch information
mgol committed Jan 7, 2016
1 parent c1511c6 commit 1a9c9b0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
12 changes: 9 additions & 3 deletions test/unit/manipulation.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -302,9 +302,15 @@ function testAppend( valueObj, assert ) {
assert.equal( jQuery( "<div/>" ).append( valueObj( "option<area/>" ) )[ 0 ].childNodes.length, 2, "HTML-string with leading text should be processed correctly" ); assert.equal( jQuery( "<div/>" ).append( valueObj( "option<area/>" ) )[ 0 ].childNodes.length, 2, "HTML-string with leading text should be processed correctly" );
} }


QUnit.test( "append(String|Element|Array<Element>|jQuery)", function( assert ) { // Support: Android 2.3 only
testAppend( manipulationBareObj, assert ); // Android 2.3 fails a lot of these tests and we accept it.
} ); // See https://github.com/jquery/jquery/issues/1785
QUnit[ /android 2\.3/i.test( navigator.userAgent ) ? "skip" : "test" ](
"append(String|Element|Array<Element>|jQuery)",
function( assert ) {
testAppend( manipulationBareObj, assert );
}
);


QUnit.test( "append(Function)", function( assert ) { QUnit.test( "append(Function)", function( assert ) {
testAppend( manipulationFunctionReturningObj, assert ); testAppend( manipulationFunctionReturningObj, assert );
Expand Down
20 changes: 18 additions & 2 deletions test/unit/offset.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -458,10 +458,26 @@ testIframe( "offset/scroll", "scroll", function( $, win, doc, assert ) {


// test jQuery using parent window/document // test jQuery using parent window/document
// jQuery reference here is in the iframe // jQuery reference here is in the iframe
// Support: Android 2.3 only
// Android 2.3 is sometimes off by a few pixels.
window.scrollTo( 0, 0 ); window.scrollTo( 0, 0 );
assert.equal( $( window ).scrollTop(), 0, "jQuery(window).scrollTop() other window" ); if ( /android 2\.3/i.test( navigator.userAgent ) ) {
assert.ok(
Math.abs( $( window ).scrollTop() ) < 5,
"jQuery(window).scrollTop() other window"
);
} else {
assert.equal( $( window ).scrollTop(), 0, "jQuery(window).scrollTop() other window" );
}
assert.equal( $( window ).scrollLeft(), 0, "jQuery(window).scrollLeft() other window" ); assert.equal( $( window ).scrollLeft(), 0, "jQuery(window).scrollLeft() other window" );
assert.equal( $( document ).scrollTop(), 0, "jQuery(window).scrollTop() other document" ); if ( /android 2\.3/i.test( navigator.userAgent ) ) {
assert.ok(
Math.abs( $( window ).scrollTop() ) < 5,
"jQuery(window).scrollTop() other document"
);
} else {
assert.equal( $( document ).scrollTop(), 0, "jQuery(window).scrollTop() other document" );
}
assert.equal( $( document ).scrollLeft(), 0, "jQuery(window).scrollLeft() other document" ); assert.equal( $( document ).scrollLeft(), 0, "jQuery(window).scrollLeft() other document" );


// Tests scrollTop/Left with empty jquery objects // Tests scrollTop/Left with empty jquery objects
Expand Down

0 comments on commit 1a9c9b0

Please sign in to comment.