Skip to content

Commit 1a9c9b0

Browse files
committed
Tests: Disable/relax a few tests failing in Android 2.3
(cherry-picked from 704de81) Fixes gh-1785
1 parent c1511c6 commit 1a9c9b0

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

test/unit/manipulation.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,15 @@ function testAppend( valueObj, assert ) {
302302
assert.equal( jQuery( "<div/>" ).append( valueObj( "option<area/>" ) )[ 0 ].childNodes.length, 2, "HTML-string with leading text should be processed correctly" );
303303
}
304304

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

309315
QUnit.test( "append(Function)", function( assert ) {
310316
testAppend( manipulationFunctionReturningObj, assert );

test/unit/offset.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,26 @@ testIframe( "offset/scroll", "scroll", function( $, win, doc, assert ) {
458458

459459
// test jQuery using parent window/document
460460
// jQuery reference here is in the iframe
461+
// Support: Android 2.3 only
462+
// Android 2.3 is sometimes off by a few pixels.
461463
window.scrollTo( 0, 0 );
462-
assert.equal( $( window ).scrollTop(), 0, "jQuery(window).scrollTop() other window" );
464+
if ( /android 2\.3/i.test( navigator.userAgent ) ) {
465+
assert.ok(
466+
Math.abs( $( window ).scrollTop() ) < 5,
467+
"jQuery(window).scrollTop() other window"
468+
);
469+
} else {
470+
assert.equal( $( window ).scrollTop(), 0, "jQuery(window).scrollTop() other window" );
471+
}
463472
assert.equal( $( window ).scrollLeft(), 0, "jQuery(window).scrollLeft() other window" );
464-
assert.equal( $( document ).scrollTop(), 0, "jQuery(window).scrollTop() other document" );
473+
if ( /android 2\.3/i.test( navigator.userAgent ) ) {
474+
assert.ok(
475+
Math.abs( $( window ).scrollTop() ) < 5,
476+
"jQuery(window).scrollTop() other document"
477+
);
478+
} else {
479+
assert.equal( $( document ).scrollTop(), 0, "jQuery(window).scrollTop() other document" );
480+
}
465481
assert.equal( $( document ).scrollLeft(), 0, "jQuery(window).scrollLeft() other document" );
466482

467483
// Tests scrollTop/Left with empty jquery objects

0 commit comments

Comments
 (0)