mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: Allow a mock QUnit.test for perfect testIframe fidelity
Ref 1d2df772b4
Closes gh-3647
This commit is contained in:
parent
bb79f728b0
commit
bb757213b2
@ -231,8 +231,11 @@ this.ajaxTest = function( title, expect, options ) {
|
||||
} );
|
||||
};
|
||||
|
||||
this.testIframe = function( title, fileName, func ) {
|
||||
QUnit.test( title, function( assert ) {
|
||||
this.testIframe = function( title, fileName, func, wrapper ) {
|
||||
if ( !wrapper ) {
|
||||
wrapper = QUnit.test;
|
||||
}
|
||||
wrapper.call( QUnit, title, function( assert ) {
|
||||
var done = assert.async(),
|
||||
$iframe = supportjQuery( "<iframe/>" )
|
||||
.css( { position: "absolute", width: "500px", left: "-600px" } )
|
||||
|
@ -26,18 +26,17 @@ var supportsFixedPosition, supportsScroll, alwaysScrollable,
|
||||
// Support: iOS <=7
|
||||
// Hijack the iframe test infrastructure to detect viewport scrollability
|
||||
// for pages with position:fixed document element
|
||||
var done = assert.async(),
|
||||
$iframe = supportjQuery( "<iframe/>" )
|
||||
.css( { position: "absolute", width: "50px", left: "-60px" } )
|
||||
.attr( "src", url( "./data/offset/boxes.html" ) );
|
||||
window.iframeCallback = function( $, win, doc ) {
|
||||
doc.documentElement.style.position = "fixed";
|
||||
alwaysScrollable = win.pageXOffset !== 0;
|
||||
window.iframeCallback = undefined;
|
||||
$iframe.remove();
|
||||
done();
|
||||
};
|
||||
$iframe.appendTo( document.body );
|
||||
var done = assert.async();
|
||||
testIframe(
|
||||
null,
|
||||
"offset/boxes.html",
|
||||
function( assert, $, win, doc ) {
|
||||
doc.documentElement.style.position = "fixed";
|
||||
alwaysScrollable = win.pageXOffset !== 0;
|
||||
done();
|
||||
},
|
||||
function( _, mockTest ) { mockTest( assert ); }
|
||||
);
|
||||
};
|
||||
|
||||
QUnit.module( "offset", { setup: function( assert ) {
|
||||
|
Loading…
Reference in New Issue
Block a user